ArduCAM / MIPI_Camera

223 stars 107 forks source link

ArduCam Stereo cameras won't work in Python #196

Open lennynpeter opened 3 months ago

lennynpeter commented 3 months ago

Hello, I would like to use the ArduCam Stereo HAT with two IMX 477 for depth mapping. With the following gstreamer pipe I get images fro the camera when running the pipe directly from the command line:

gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! 'video/x-raw(memory:NVMM),width=1920, height=1080, framerate=20/1, format=NV12' ! nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=720' ! nvvidconv ! nvegltransform ! nveglglessink -e

If I use the sample Python program, I get the following error:

GST_ARGUS: Creating output stream CONSUMER: Waiting until producer is connected... GST_ARGUS: Available Sensor modes : GST_ARGUS: 4056 x 3040 FR = 10.000000 fps Duration = 100000000 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 2028 x 1520 FR = 40.000000 fps Duration = 25000000 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 2028 x 1080 FR = 50.000000 fps Duration = 20000000 ; Analog Gain range min 1.000000, max 22.250000; Exposure Range min 13000, max 683709000;

ARGUS_ERROR: Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute: 895 Frame Rate specified is greater than supported GST_ARGUS: Running with following settings: Camera index = 0 Camera mode = 0 Output Stream W = 4056 H = 3040 seconds to Run = 0 Frame Rate = 10.000000 GST_ARGUS: Setup Complete, Starting captures for 0 seconds GST_ARGUS: Starting repeat capture requests. CONSUMER: Producer has connected; continuing. ARGUS_ERROR: Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute: 1131 InvalidState. GST_ARGUS: Cleaning up [ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module nvarguscamerasrc0 reported: Internal data stream error. nvbuf_utils: dmabuf_fd -1 mapped entry NOT found nvbuf_utils: Can not get HW buffer from FD... Exiting... CONSUMER: ERROR OCCURRED [ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline [ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created Traceback (most recent call last): File "/home/peterl/Desktop/pyPro/test.py", line 135, in camera = Camera() File "/home/peterl/Desktop/pyPro/test.py", line 107, in init self.open_camera() File "/home/peterl/Desktop/pyPro/test.py", line 112, in open_camera raise RuntimeError("Failed to open camera!") RuntimeError: Failed to open camera!

I'm pretty new to gstreamer, so any help would be very much appreciated. Thanks in advance.