Ask Your Question

Revision history [back]

Hello,

thanks for your answer. Splitting and working with cvtColorTwoPlane like suggested crashes. But finally your suggest leads me to the rigth answer:

frame = Mat(300, 200, CV_8UC2,data);
bgrFrame = Mat(300,200, CV_8UC3);
cvtColor(frame, bgrFrame, COLOR_YUV2BGR_UYVY, 0);

bgrFrame is now in the format (and correctly filled) so that it can be displayed for instance with imshow.

UYVY data could be generated like this (full red in this example):

for (int i = 0 ; i < xres  * yres * 2 ; i+=4)
    {
        data[i] = 102;
        data[i+1] = 62;
        data[i+2] = 239;
        data[i+3] = 62;
    }

Where xres and yres is the resolution. Two pixels r = 255, g = 0 and r = 0 are the same us two Pixels UYVY in the order (102,62,239,62)

so, thanks again for your help & best regards

Markus