Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
EGCVants opened this issue May 4, 2024 · 2 comments
Open

Comments

@EGCVants
Copy link

EGCVants commented May 4, 2024

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)

@PaulTR
Copy link
Collaborator

PaulTR commented May 4, 2024 via email

@PaulTR
Copy link
Collaborator

PaulTR commented May 7, 2024

Alright maybe this will help :) https://gist.github.com/jeffehobbs/d9cbe007c94517cb758dd5e69413cfd6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants