mediapipe icon indicating copy to clipboard operation
mediapipe copied to clipboard

'ERROR: Unable to read from webcam. Please verify your webcam settings.'

Open EGCVants opened this issue 2 months ago • 2 comments

I would appreciate if anyone could provide assistance regarding this error message. Mediapipe has been installed and the camera being used with the Raspberry Pi 4 is functioning, which was verified by using the following command to test it.

libcamera-still -o test.jpg

The issue however occurs when attempting to run the recognize.py script, which gives me the error: "ERROR: Unable to read from webcam. Please verify your webcam settings."

I'm unsure if the issue is coming from the use of cv2 and the introduction of the new python library PiCamera2 or something else entirely. The following code seems to be where the error is occurring, but I just don't how to resolve it. Again, I'd greatly appreciated the help if possible.

Continuously capture images from the camera and run inference

while cap.isOpened(): success, image = cap.read() if not success: sys.exit( 'ERROR: Unable to read from webcam. Please verify your webcam settings.' ) Lines(100-106)

where cap seems to instantiated below as cv2:

Start capturing video input from the camera

cap = cv2.VideoCapture(camera_id) cap.set(cv2.CAP_PROP_FRAME_WIDTH, width) cap.set(cv2.CAP_PROP_FRAME_HEIGHT, height)

Lines(56-59)

EGCVants avatar May 04 '24 18:05 EGCVants