alliedvision / linux_nvidia_jetson

Allied Vision CSI-2 camera driver for NVIDIA Jetson Systems.
104 stars 41 forks source link

Python Byndings #2

Closed beniroquai closed 2 years ago

beniroquai commented 4 years ago

Is it possible to access the frames from a python routine as it's done in picamera for the raspberry pi?

fklostermann commented 4 years ago

Thank you for your question. The CSI-2 driver supports the V4L2 interface for capturing frames. Any Python package that uses this interface should work, e.g. python-v4l2capture

beniroquai commented 4 years ago

Thanks for your quick reply! We managed to get the camera working with openCV+Gstreamer. You can find our working example here

I was wondering if there is a way to get the full 12-bit dynamic range using the Allied Vision Alvium 1800 C-158 camera using the above mentioned script. It seems that openCV cv.VideoCapture only receives 8Bit.

Thank you very much for your reply!

fklostermann commented 4 years ago

Nice to hear that you got it running! :) Currently, there is no 12-bit pixelformat available.

The following V4L2 pixel formats are supported on the NVidia boards with the Alvium camera: 8-bit Mono: V4L2_PIX_FMT_GREY (GREY) (mono cameras only) 8-bit Bayer: V4L2_PIX_FMT_SGRBG8 (color cameras only) 24-bit RGB: V4L2_PIX_FMT_XRGB32 (BX24) 24-bit BGR: V4L2_PIX_FMT_XBGR32 (XR24) 16-bit YUV: V4L2_PIX_FMT_VYUY

beniroquai commented 4 years ago

Thanks for the prompt answer!

Currently we call the camera using this: 'v4l2src device='+ mycamera+ ' extra-controls='+'"'+'c,exposure='+str( myexp_time)+',exposure_auto=1'+'"' +' ! video/x-raw, format=BGRx ! videoconvert ! appsink'

How could we change this line to get the 24bit or 16 bit output? the cap.read() is outputting a 3-channel RGB frame, where each channel has the same information.

Any ideas how to solve this?

fklostermann commented 4 years ago

The format "BGRx" refers to the above-mentioned 24 bit BGR format using 8 bit per channel. At the moment, there is no pixel format with a bit depth greater than 8 available.

sharoseali commented 4 years ago

Thanks for your quick reply! We managed to get the camera working with openCV+Gstreamer. You can find our working example here

I was wondering if there is a way to get the full 12-bit dynamic range using the Allied Vision Alvium 1800 C-158 camera using the above mentioned script. It seems that openCV cv.VideoCapture only receives 8Bit.

Thank you very much for your reply!

HI @beniroquai Hope the things are going well. I tried to open the link to see the python based code for accessing frames from camera but the link is not working. I have agx XAVIER and trying to work on python with this camera. Can you please share the python bindings so that I can try. Please also share your image quality and frame rate experience as I want to use it on drone for aerial scene. So is that camera will be good enough to work with? will be very thankful to you .... Thanks

beniroquai commented 4 years ago

Hey, you can check the official Vimba Python which runs on the jetson. It's not straightforward to make it work with openCV, but I give a tutorial for the Jetson Nano here. Hope that helps.