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?