"Could not read image from camera" and "Could not initialize camera. Please see error trace."

When I try to run data_collection.ipynb in the “Collision Avoidance” project, I’m at the part where I run the following:

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 I’m getting is:

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-5-2af115b26558> in <module>
      4 from jetbot import Camera, bgr8_to_jpeg
      5 
----> 6 camera = Camera.instance(width=224, height=224)
      7 
      8 image = widgets.Image(format='jpeg', width=224, height=224)  # this width and height doesn't necessarily have to match the camera

/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.

I’ve looked through a bunch of threads with the same issue, and none of them seem to have a fix that works for me. Any help is appreciated. Thanks!

Hi,

What kind of camera do you use?
The script by default launches the camera with Argus API for the CSI camera:

More, which container do you use? Jetson-inference or jetbot?

Thanks.

Hi @AastaLLL, the camera (I believe) is the CSI camera. I’m able to run some of the jetson-inference projects by using this command:

imagenet csi://0 webrtc://@:8554/my_output

I’m actually trying to put both the Jetson-inference and the jetbot projects all into one sdcard image. For the collision and road following projects, I’m running the jetbot container.

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