Help. Error: could not read image from camera and could not initialize USB camera

Hi
I have been doing the tutorial on Hello camera, with the USB camera, without success:

RuntimeError: Could not read image from camera.
RuntimeError: Could not initialize camera.

What should I do? The camera is working just fine when I use the opencv library

import cv2
cap = cv2.VideoCapture(0) # 0
cap.isOpened()
ret, img = cap.read()
cv2.imwrite(“image.jpg”,img)

All the help would be greatly appreciated

Cheers!

Hi,

could you share a Link to the tutorial ?
Is the Camera working when you use the Code you shared with us ?

Hi n.ferreira.
Thank you for your reply.

It is the jetson nano tutorial on connecting a camera to the Jetson nano

and yes, the camera works when I use the code I submitted.
Also, I did use the command cap.release() after the cv2.imwrite command.

The jetcam library seems to be there, as import jetcam resulted in no error message.

Hi,
For launching USB cameras, please check Jetson Nano FAQ
Q: I have a USB camera. How can I lauch it on Jetson Nano?

1 Like

Hi,

Have you tried the solution to this problem posted on GitHub ?

Thank you DaneLLL

I have tried the sudo apt install v4l-utils, but where I am now there are no hubs available (everything is wifi). I have to get back home to try this. Unless there is a way to connect the nano to the internet without a wifi card or without ethernet…

Dear DaneLLL
Thank you, thank you, thank you and thank you!
I did what you have suggested (and setting the video to 0) and the tutorial using jetcamera worked beautifully.
Would it be possible to tell me what was the problem and how the problem was solved?
Thank you again and looking forward to hearing from you
Cheers!