jetcam icon indicating copy to clipboard operation
jetcam copied to clipboard

Could not read-image from camera: USB Camera

Open NiranjanRavi1993 opened this issue 3 years ago • 4 comments

Hi, We are trying to interface a USB camera with Jetson NX using jetcam libraries:

from jetcam.usb_camera import USBCamera

But during the initialization, we get an error:

[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Cannot identify device '/dev/video2'. [ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py", line 24, in init RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "threecamera.py", line 47, in HildaCam = Hilda_cam.Hilda_Cam(Log, cam_width=336, cam_height=224, cam_fps=60) File "/home/jetsonnx/Dojo/Hilda_cam.py", line 14, in init self.camera_right = USBCamera(width=cam_width, height=cam_height, capture_width = 640, capture_height = 480, capture_device=2) File "/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py", line 28, in init RuntimeError: Could not initialize camera. Please see error trace.

I checked the openCV version,it is 4.1.1. The interface works when there is CSI Cameras but it does not work with USB camera. I tried solutions suggested as,

Replacing, self.cap = cv2.VideoCapture(self._gst_str(), cv2.CAP_GSTREAMER) with self.cap = cv2.VideoCapture(self.capture_device)

With lusb command, the usb devices are getting picked up, have attached the image. But it is not initializing.

But still the error persists. Would be helpful to know if any other workaround is possible? Thanks.

NiranjanRavi1993 avatar Apr 06 '21 19:04 NiranjanRavi1993

same problem

Klawens avatar Apr 09 '22 13:04 Klawens

With Jetson nano , as the same problem

aaawooo avatar Jun 05 '22 03:06 aaawooo

csi cam works well,but there is always the same problem with usb cam,

3111395644 avatar Jul 11 '23 08:07 3111395644

I solved the problem with my usb cam,here is my advice: 1.please make sure that your usb cam is logi C270 2.please make sure that there is only one cam attached to your jetson 3.please make sure that the code of jetcam had not been modified

3111395644 avatar Jul 12 '23 13:07 3111395644