I needed two cameras for a project requirement. To test the working of the tow cameras together I wrote a short that goes as follows:
import cv2,os import numpy as np webcam = cv2.VideoCapture(0) webcam1 = cv2.VideoCapture(1) while True: ret0,frame = webcam.read() ret1,frame1 = webcam1.read() if(ret0): cv2.imshow('Webcam',frame) if(ret1): cv2.imshow('Webcam1',frame1) if cv2.waitKey(1) & 0xFF == ord("q"): break cv2.destroyAllWindows() webcam.release() webcam1.release()
On running the code one camera starts running fine while the other raises an error below:
VIDEOIO ERROR: V4L2: Could not obtain specifics of capture window. VIDEOIO ERROR: V4L: can't open camera by index 1 /dev/video1 does not support memory mapping
How do I rectify this?