Issue Connecting USB Camera to DLI/Jupyter hello_camera

I’m having trouble initializing my USB webcam in the hello_camera module of the DLI. I’m using the Logitech C270 and a Jetson Nano flashed with the DLI image. When I run

camera = USBCamera(width=224, height=224, capture_width=1920, capture_height=1080, capture_device=0)

the output is:

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in __init__(self, *args, **kwargs)
     23             if not re:
---> 24                 raise RuntimeError('Could not read image from camera.')
     25 

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-3-eeb6264294ab> in <module>
      4 
      5 #TODO change capture_device if incorrect for your system
----> 6 camera = USBCamera(width=224, height=224, capture_width=1920, capture_height=1080, capture_device=0)

/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in __init__(self, *args, **kwargs)
     26         except:
     27             raise RuntimeError(
---> 28                 'Could not initialize camera.  Please see error trace.')
     29 
     30         atexit.register(self.cap.release)

RuntimeError: Could not initialize camera.  Please see error trace.

When I run

!ls -ltrh /dev/video*

the output is:

crw-rw----+ 1 root video 81, 0 Jun 14 21:48 /dev/video0

I know the webcam/the connections are fine because after trying to run usb_camera.ipynb I then went to terminal and ran in python

import cv2
cam = cv2.VideoCapture(0)
ret, frame = cam.read()
cv2.imwrite("test.png", frame)

Which succesfully put an image from the webcam in my directory. I tried running

sudo systemctl restart nvargus-daemon

in the terminal and then pulling the power plug and putting it back in, but ended up with the same result.

Any thoughts on what’s wrong? maybe my initial setup of booting with the camera attached or something simple like that?

Hi,
We support gstreamer and tegra_multimedia_api. Please check if you are able to launch your camera in a gstreamer pipeline:
https://devtalk.nvidia.com/default/topic/1057681/jetson-tx1/logitech-c930e-on-jetson-tx1-very-slow-and-choppy-video/post/5363417/#5363417

We would like to clarify that Argus APIs are for Bayer sensors, not for USB cameras. Restarting nvargus-daemon does not help the case. USB cameras go through kernel UVC driver.

Both those commands worked and I got the video stream to work. I think the issue was that I was not giving the command th eright width/height for image capture.

Even I ran the said commands but I still get the same error!!!
Am kind of confused, for what is the pipeline command used for.
Just to check? If it working? It works I guess from the output I see.
as of now I get this output in the terminal (its just the terminal, nothing else!) ->

Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

Is this the expected output?
Am I supposed to do anything else to get this working?
Actually this is the first time am seeing this error!
Because I have been using the same code over and over for many days now!


RuntimeError Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam/usb_camera.py in init(self, *args, **kwargs)
23 if not re:
—> 24 raise RuntimeError(‘Could not read image from camera.’)
25

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-4-5a6744da9a88> in <module>
      2 
      3 #TODO change capture_device if incorrect for your system
----> 4 camera = USBCamera(width=224, height=224, capture_width=640,     capture_height=480, capture_device=0)

/usr/local/lib/python3.6/dist-packages/jetcam-0.0.0-py3.6.egg/jetcam    /usb_camera.py in __init__(self, *args, **kwargs)
     26         except:
     27             raise RuntimeError(
---> 28                 'Could not initialize camera.  Please see error trace.')
     29 
     30         atexit.register(self.cap.release)

RuntimeError: Could not initialize camera.  Please see error trace.

I recently made an update which costed me 5xxmb, could it be possible that the update caused some issue with any library? If yes, how do I reinstall jetcam?
I tried running the scripts from jetcam repo but still no change!
I tested my cam in Cheese Webcam Booth it works there but this little piece of code still gives me the above mentioned trouble!

from jetcam.usb_camera import USBCamera
camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)

Hi jaimonalphons,

Please open a new topic for your issue. Thanks