Ask Your Question

Revision history [back]

The videoCapture does exactly what you want.

http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=video#VideoCapture

Steps to follow:

  • Create the videoCapture interface, giving the index of your webcam to it.
  • Grab a frame, which is automatically stored in a Mat element.
  • Use the imsave functionality to store the Mat into an image.

http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imwrite#cv2.imwrite

click to hide/show revision 2
No.2 Revision

The videoCapture VideoCapture does exactly what you want.

http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=video#VideoCapture

Steps to follow:

  • Create the videoCapture VideoCapture interface, giving the index of your webcam to it.
  • Grab Grab a frame, which is automatically stored in a Mat element.Mat
  • Use the imsave imwrite functionality to store the Mat into an image.

http://docs.opencv.org/modules/highgui/doc/reading_and_writing_images_and_video.html?highlight=imwrite#cv2.imwrite