Jetson Xavier AGX - USB Camera Issue

I am using USB cameras with Jetson Xavier AGX. To keep the application simple, I want to read images from two USB cameras and store them in separate directories. But I am facing the below issues:

  1. When I plug in two USB cameras to Jetson and run /ls/dev/video* → it shows there are 4 devices connected.
    This is not right whereas I connected only two. How to resolve this?

  2. I am using python and cv2 to read the images like below:
    import cv2
    cap = cv2. VideoCapture(0)
    cap2 = cv2. VideoCapture(1)

while cap.isOpened():
#My code to save to the directory.

But I get an error “cannot open the camera by index” Not sure what’s going wrong! I unplug the device and repeat, and in one of many attempts, it’s reading fine else the same error repeats.

  1. When i faced the above error, I had to manually unplug and re-plug. Is there any other way I can do that? I do not want to unplug and replug everytime as my camera’s connectivity is fragile.

It would be helpful to get some guidance.

Thank you.

Please try the samples:
V4l2src using OpenCV Gstreamer is not working in Jetson Xavier NX - #3 by DaneLLL
Issue with multi-camera gstreamer capture using OpenCV - #6 by DaneLLL

The default OpenCV installed through SDKManager enables gstreamer and the samples shall work fine. Please give it a try.

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