Categories
code opencv python video

[Python] OpenCV capturing from a v4l2 device

A python snippet on capturing from a v4l2 camera into OpenCV

I tried to set the capture format on a webcam from OpenCV’s cv2.VideoCapture and ran into a problem: it’s using the wrong IOCTL command.
So I used python-v4l2capture to get images from the device, which allows more control.
Here is the gist:

Enjoy!
Roy