Usb camera on preview

I would like to use a USB camera as a constant preview camera and a pi camera to record. At the moment I can use the picamera to preview and record but can't work out the code to use a USB camera on preview. How could I do this and have a full screen on start up.
Also is it possible to use the picamera overlay (pi camera. Read the docs) with a USB camera.
Cheers
John

piborg's picture

From experience most USB cameras will work with the V4L2 system and simply appear as a different video input in the list. When I have been using the OpenCV library in Python it is just a case of selecting the correct camera by number.

For example:

import cv2

piCamera = cv2.VideoCapture(0)
usbCamera = cv2.VideoCapture(1)

As for using the bits designed for the Pi Camera specifically, I am not sure how they work. It is probably better to ask on the Raspberry Pi Forums as other people know a lot more on this topic than we do :)

Subscribe to Comments for "Usb camera on preview "