Cannot create Camera.instance() objecet

Hey there!
We’re a couple of students on our course final’s project which revolves around computer vision using the Jetson Nano 4gb B01 equipped with the Waveshare JetBot AI Kit.
The problem is that when we try to run the pre-installed jupyter “Getting Started” notebooks, we get stuck in the second " Collision Avoidance" part, namely where you need to initialize the Camera.instance() function.
The code we’re trying to run:

import traitlets
import ipywidgets.widgets as widgets
from IPython.display import display
from jetbot import Camera, bgr8_to_jpeg

camera = Camera.instance(width=224, height=224)

image = widgets.Image(format='jpeg', width=224, height=224)  # this width and height doesn't necessarily have to match the camera

camera_link = traitlets.dlink((camera, 'value'), (image, 'value'), transform=bgr8_to_jpeg)

display(image)

The error we keep getting:


RuntimeErrorTraceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/jetbot-0.4.3-py3.6.egg/jetbot/camera/opencv_gst_camera.py in __init__(self, *args, **kwargs)
     29             if not re:
---> 30                 raise RuntimeError('Could not read image from camera.')
     31 

RuntimeError: Could not read image from camera.

During handling of the above exception, another exception occurred:

RuntimeErrorTraceback (most recent call last)
<ipython-input-7-1e624ef12a29> in <module>
      4 from jetbot import bgr8_to_jpeg
      5 
----> 6 camera = Camera.instance(width=224, height=224, usb=1)
      7 camera_rgb = Camera.instance(width=224, height=224, usb=1)

/usr/local/lib/python3.6/dist-packages/jetbot-0.4.3-py3.6.egg/jetbot/camera/opencv_gst_camera.py in instance(*args, **kwargs)
     70     @staticmethod
     71     def instance(*args, **kwargs):
---> 72         return OpenCvGstCamera(*args, **kwargs)

/usr/local/lib/python3.6/dist-packages/jetbot-0.4.3-py3.6.egg/jetbot/camera/opencv_gst_camera.py in __init__(self, *args, **kwargs)
     35             self.stop()
     36             raise RuntimeError(
---> 37                 'Could not initialize camera.  Please see error trace.')
     38 
     39         atexit.register(self.stop)

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

Checked the connections, switched between cameras (raspberry pi camera and the IMX 219 jetson camera),
v4l2-ctl --list-devices prints:

vi-output, imx219 7-0010 (platform:54080000.vi:0):
        /dev/video0

Could really use anyone’s help, thanks!

Bump

Sorry for the late response, is this still an issue?

Could you check the nvgstcapture-1.0 working to clarify the camera working normally first.

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