Is YUV2BGR_NV12 conversion necessary to imshow an YUV image?

asked 2019-09-15 12:05:48 -0500

JeyP4 gravatar image

updated 2019-09-15 14:11:06 -0500


I have NV12 (YUV 4:2:0) image data. I am able to convert it to BGR through following code.

YUV = Mat(H+H/2, W, CV_8UC1, pointerToData);    // YUV Mat initialization
RGB = Mat(H, W, CV_8UC3);              // RGB Mat initialization
cvtColor(YUV, img, CV_YUV2BGR_NV12, 3);//color conversion  (computationally expensive for 4K)

Is it possible to skip cvtColor operation, because I find it computationally expensive. I just want to view the (YUV) image, I don't need new RGB mat.

edit retag flag offensive close merge delete