Ask Your Question
0

Mat using YUV 422 Video

asked 2014-05-12 04:23:07 -0500

StudentFeM gravatar image

updated 2014-05-12 08:23:45 -0500

Hello,

I'd like to write a single videoline, which is stored on DDR-RAM, in a Mat Object.

I have initialized an int-Array and convert it to a Mat Object:


int *Video_Line = (int *) calloc(1920, sizeof(int));
Mat videoline = Mat(1, 1920, CV_8UC3, Video_Line); 
Now the write function:

for(int i=0; i <= 1920; i++)
{
    unsigned long val = getData((DPRAM_START+i));
    Video_Line[i] = val;
}

The output is:


Mat = {99, bc, 12, bc, 99, bc, ...}
That correspond to:

Mat = [Y0, Cr0, Y1, Cb1, Y2, Cr2, ...]
How can I explain MAT, that the data are in YUV 422?

That is important to calculate a histogram.

Best regards,

Michael

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted
0

answered 2015-01-07 17:48:37 -0500

Hi Michael!

Probably the best option to this problem, is separate the different channels of your videoline (Y,U and V).

Something like this: Mat yuv422_DDR_RAM = {99, bc, 12, bc, 99, bc, ...}

Mat y = {99,12,99,...} Mat u = {bc,bc,...} Mat v = {bc,...}

After this, you can calculate the histogram of channel Y, using the OpenCV functions and the object cv::Mat y. Repeat the process to channel U and channel V.

If you want the original image you must resize cv::Mat u and cv::Mat v to the same values of width and height of cv::Mat y. After the resizing process you can merge the objects Mat y, u and v.

Cheers, Victor

edit flag offensive delete link more

Comments

Which are your values for the width and height of the original video ?

Victor Fernandes gravatar imageVictor Fernandes ( 2015-01-07 17:50:57 -0500 )edit
Login/Signup to Answer

Question Tools

Stats

Asked: 2014-05-12 04:23:07 -0500

Seen: 1,944 times

Last updated: Jan 07 '15