I am currently following along with the getting started with AI Jetson nano course and I came across a problem with my USB camera. I am currently on the HEllO Camera part of the course on Jupiter Lab and when I get to the part where I run this code:
from jetcam.usb_camera import USBCamera
#TODO change capture_device if incorrect for your system
camera = USBCamera(width=224, height=224, capture_width=640, capture_height=480, capture_device=0)
I get this :
---------------------------------------------------------------------------
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-2-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 have even tried running this in the command prompt to see if I could turn it on and use it through Gstreamer:
gst-launch-1.0 -v v4l2src device=/dev/video0 ! jpegdec ! video/x-raw,framerate=30/1,width=1280,height=720 ! videoconvert ! xvimagesink
But got this instead don’t know if this relates to what’s going on in Jupyter lab:
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0: Could not initialise Xv output
Additional debug info:
xvimagesink.c(1773): gst_xv_image_sink_open (): /GstPipeline:pipeline0/GstXvImageSink:xvimagesink0:
Could not open display (null)
Setting pipeline to NULL ...
Freeing pipeline ...[spoiler]This text will be blurred[/spoiler]