Conversion of YUV420p to RGB

Is there a routine on TX1 analogous to OpenCV’s “cvtColor(yuvbuf, RGB, COLOR_YUV420p2RGB)” ? I am looking for faster(maybe hardware accelarator which could do this) and more reliable method to convert YUV420p to RGB as openCV’s method is inconsistent.

cvtColor randomly returns either BGR or RGB which ideally should not happen.

PS: I am operating at 60FPS

MMAPI has a sample that uses cuda to do YUV to RGB conversion. (v4l2cuda)
Also a plane conversion sample using VIC. (00_video_decode and 07_video_convert)

In additional to @WayneWWW,

Because VIC supports RGBA and BGRx formats but does not support BGR, we do RGBA → BGR via CUDA. The sample is tegra_multimedia_api\samples\backend

thanks WayneWWW and DaneLLL.

https://devtalk.nvidia.com/default/topic/1022627/jetson-tx2/12_camera_v4l2_cuda-not-working/post/5205524/#5205524

According to this post v4l2 will not work with TegraISP. I will try the plane conversion sample using VIC as per your suggestion. I hope that will work with bayer sensor camera(IMX274)?

You can refer to https://developer.nvidia.com/embedded/dlc/l4t-accelerated-gstreamer-guide-28-1 for using nvcamerasrc and nvvidcon for isp and conversion respectively.

You may also refer to https://github.com/dusty-nv/jetson-inference/blob/master/util/cuda/cudaYUV-NV12.cu

1 Like