USB Camera through jetcam cannot be initialized

  • Jetson Nano developer kit 2GB
  • JetPack 4.5.1 from pre-built image (download Center)
  • USB 2.0 webcam
  • Power: USB-C

nvgstcapture-1.0 can show preview and take a picture.
However, when it comes to jetcam, it cannot be initialized at all.
This code works pretty well on the Jetson Nano 4GB dev kit.
Cheese as well, like jetcam.

Is it HW issue to consider?
Thanks,

Hi,
There is a known issue about opening USB cameras through 3rdparty application:
Jetson/L4T/r32.5.x patches - eLinux.org
[camera] 3rdparty application fails to open with USB camera

Please apply the prebuilt lib and give it a try.

@DaneLLL

jetcam from GitHub - NVIDIA-AI-IOT/jetcam: Easy to use Python camera interface for NVIDIA Jetson
sd image is from the download center.

Error code here:
'ā€”

jetson@jetson-desktop:~/ws$ python3
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from jetcam.usb_camera import USBCamera
>>> camera = USBCamera(capture_device=0)
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) h
andleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Inter
nal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) op
en OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) is
PipelinePlaying 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 "<stdin>", line 1, in <module>
  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.

Thanks,

Hi,
This setup is complicated and 2GB RAM is not sufficient. Please run with Nano 4GB for demonstration and further development.

Thanks @DaneLLL
The reason is poor camera does not fit the default configuration.
A little modification of USBCamera init, I could run it.

1 Like

Could you please guide me on how you did it? Iā€™m facing the exact same issue

  1. find out which formats your cam support
    $ v4l2-ctl --list-formats-ext
  2. RAW format has 640x480@30fps?
  3. jetcam has 640x480 with 30fps as default parameters.
    In my case, 25fps. Then I added the parameter when I use jetcam even gst-launch-1.0.

For example, for jetcam,
camera = USBCamera(capture_fps=25, capture_device=0, capture_width=640, capture_height=480)

A correction to the post above, for those using the command shared above by @MtHiker , it is:
v4l2-ctl --list-formats-ext

1 Like

Thanks @cqdev

Fixed!

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.