Can't receive raw12 frame into openCV

Hi,

I am getting raw12 CSI data from custom sensor.
The resolution is 2038x384 @25fps

When running
gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=2048, height=384, format=NV12, framerate=25/1' ! nvoverlaysink

I can see the frames on the display.

But when I am running the following:

import cv2
gst_str = ('nvarguscamerasrc ! video/x-raw(memory:NVMM), width=2048, height=384, format=(string)NV12, framerate=25/1 ! nvvidconv ! video/x-raw, format=NV12 ! appsink')
cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)
cap.isOpened()

Capture did not opened.

I have also tried the following:

import cv2
gst_str =  ('nvarguscamerasrc ! video/x-raw(memory:NVMM), width=2048, height=384, format=(string)NV12, framerate=25/1 ! nvvidconv ! video/x-raw, width=2048, height=384,format=NV12, framerate=25/1 ! appsink') 
cap = cv2.VideoCapture(gst_str, cv2.CAP_GSTREAMER)

But this did not succeeded either.

How can I get the raw12 frames, without any conversion, to openCV ?

Thanks,
Ron

Hi,
In the command the format is NV12. Please convert to BGR. You can try this sample:
OpenCV Video Capture with GStreamer doesn't work on ROS-melodic - #3 by DaneLLL

RAW formats are not supported in OpenCV. If you would like to get raw frames and do processing, we suggest capture to CUDA buffers and implement processing through CUDA. For capturing frames through v4l2, you can take a look at

/usr/src/jetson_multimedia_api/samples/v4l2cuda/

By default the data format is V4L2_PIX_FMT_UYVY. You would need to modify it according to your camera source,

Hi,

I can’t convert to other format, as this is not a video frame - this is radar ADC samples.

I will take a look at the v4l2cuda example.

Thanks,
Ron

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