Runcam5 Gstreamer pipeline using Opencv

Hello everyone,

I want to run my runcam5 camera with gstream pipeline by using opencv but I have some problem.

Firstly When I start the program on the terminal screen, there is no problem with the colors. Everything is okey.(I am using below code )

gst-launch-1.0 v4l2src device=/dev/video1 io-mode=2 ! image/jpeg,width=1280,height=720 ! nvjpegdec ! video/x-raw ! nvvidconv ! 'video/x-raw(memory:NVMM),format=I420' ! nvoverlaysink

Because I am new on gstream pipeline and I dont convert above code to opencv appsink. How can I convert this?

Additionally, while inspecting the forum, I found the code below.

cap = cv2.VideoCapture("v4l2src device=/dev/video1 io-mode=2 ! image/jpeg, width=(int)1280, height=(int)720, framerate=30/1 ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink", cv2.CAP_GSTREAMER)

Although it worked in the code above, there were color distortions.

How can I solve these problem? Have any idea? Thank you for your helping.

Hi,
Please apply this and check if the color is correct:
https://elinux.org/Jetson/L4T/r32.4.x_patches
[GSTREAMER]Prebuilt lib for decoding YUV422 MJPEG through nvv4l2decoder

1 Like

It is worked for me thank you DaneLLL

1 Like