Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Write Mat from DDR-RAM

Hey There,

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)); //Allocate 1920 1D int Array
Mat videoline = Mat(1, 1920, CV_8UC1, Video_Line);  //Convert to Mat
Now the write function:

for(int i=0; i <= 1920; i++)
{
    unsigned long val = getAddressValue((DPRAM_START+i)+(3i));
    unsigned short int YCb = val;
    unsigned int YCr = (val >> 16 ); 
Video_Line[i+d] = YCr; Video_Line[i+1+d] = YCb; d++; }

My Problem: The format does not make any sense. It should be like:


Mat = [Y0, Cr0, Y1, Cb1, Y2, Cr2, ...]
But the result is:

Mat = [80, 4b, 0, 0, 80, 4b, 0, 0, 80, 4b, 0, 0, 80, 4b, 0, 0, 80, 4b, 0, 0, ]
How can I set up YCrCb-format for Mat?

Best regards,

Michael

Write Mat from DDR-RAMusing YUV 422 Video

Hey There,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 *Video_Line = (int *) calloc(1920, sizeof(int)); //Allocate 1920 1D int Array
sizeof(int));
Mat videoline = Mat(1, 1920, CV_8UC1, CV_8UC3, Video_Line);  //Convert to Mat
 
Now the write function:

for(int i=0; i <= 1920; i++)
{
    unsigned long val = getAddressValue((DPRAM_START+i)+(3i));
getData((DPRAM_START+i));
 unsigned short int YCb Video_Line[i] = val;
    unsigned int YCr = (val >> 16 ); 
Video_Line[i+d] = YCr; Video_Line[i+1+d] = YCb; d++;
}

My Problem: The format does not make any sense. It should be like: output is:


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

Mat = [Y0, Cr0, Y1, Cb1, Y2, Cr2, ...]
But the result is:

Mat = [80, 4b, 0, 0, 80, 4b, 0, 0, 80, 4b, 0, 0, 80, 4b, 0, 0, 80, 4b, 0, 0, ]
How can I set up YCrCb-format for Mat?explain MAT, that the data are in YUV 422?

That is important to calculate a histogram.

Best regards,

Michael