How to record video with 1 gigE camera and 1 USB camera at different framerates?

asked 2018-11-14 16:37:49 -0500

Hi I am a newbie to Python and OpenCV, and would like to start using OpenCV and Python to write a GUI to control our experiments. Ideally, we have one high-resolution gigE camera (via ethernet) with 60 fps recording animal's pupil, and another lower-resolution USB camera with 30 fps recording animal's whole body. Our gigE camera can be externally triggered. I know the USB camera wouldn't be triggered, so theoretically they are not really grabbing each frames simultaneously, but I would want both cameras to start at the same time (i.e., t = 0, both cameras start running, and 10 seconds in gigE camera video will be same as 10 seconds in USB camera).

I have seen posts showing how to record video with 2 web cameras simultaneously. However, those cameras usually have same frame rates. I don't know how I can initiate and record with above cameras. Any suggestions or example scripts on how I can do this? Thank you very much!

edit retag flag offensive close merge delete

Comments

supra56 gravatar imagesupra56 ( 2018-11-14 20:15:38 -0500 )edit
1

@supra56 Thank you for suggestion. I actually went to read the tutorial, but not sure how to apply that to our case. The tutorial didn't talk about running two cameras at the same time. Do I just simply put another cap = cv2.VideoCapture(1) below cap = cv2.VideoCapture(0)?

DanaChang gravatar imageDanaChang ( 2018-11-15 13:13:07 -0500 )edit

cap = cv2.VideoCapture(0)

cap1 = cv2.VideoCapture(1)
supra56 gravatar imagesupra56 ( 2018-11-15 20:30:13 -0500 )edit