pi-top-Python-SDK icon indicating copy to clipboard operation
pi-top-Python-SDK copied to clipboard

Having hard time with camera

Open vovikdrg opened this issue 1 year ago • 3 comments

My Kids are doing line following but they are constantly getting an error

Exception in thread Thread-7:
Traceback (most recent call last):
  File "/usr/lib/python3.9/threading.py", line 954, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.9/threading.py", line 892, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/lib/python3/dist-packages/pitop/camera/camera.py", line 294, in __process_camera_output
    self._frame_handler.frame = self._camera.get_frame()
  File "/usr/lib/python3/dist-packages/pitop/camera/core/cameras/usb_camera.py", line 75, in get_frame
    raise ValueError("Couldn't grab frame from camera")
ValueError: Couldn't grab frame from camera



[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (880) open VIDEOIO(V4L2): can't find camera device
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (1824) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Cannot identify device '/dev/video-1'.
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (914) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global ../modules/videoio/src/cap_gstreamer.cpp (501) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0] global ../modules/videoio/src/cap_v4l.cpp (880) open VIDEOIO(V4L2): can't find camera device
Traceback (most recent call last):
  File "/home/pi/Desktop/Projects/Test/Pitoptest.py", line 25, in <module>
    cam = Camera(format="OpenCV")
  File "/usr/lib/python3/dist-packages/pitop/camera/camera.py", line 58, in __init__
    self._camera = UsbCamera(
  File "/usr/lib/python3/dist-packages/pitop/camera/core/cameras/usb_camera.py", line 57, in __init__
    raise IOError(
OSError: Error opening camera. Make sure it's correctly connected via USB.

They do have a loop where they try to grab cam.get_frame and this error occurs.

Could it be that camera it self is dead ?

vovikdrg avatar Aug 16 '24 09:08 vovikdrg