Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
2 Views

Dealing with planar images

Hello,

I would like to process an image from which I have three pointers, one for each component. Using a P3R method, I wanted to know how to give this picture as an input (in general, for every method).
More precisely, some points are not clear for me:

- Is well Ipp* pSrc[3] a pointer to a tabular of three pointers (one for each component)?
- What about IppiSize srcSize if my sampling is not 4:4:4 (for example, YUV422)? Is it well the size of the first component?
- Same question about int srcStep

Maybe that the answers might seem straightforward, but I'm wondering that because, using ippiResize_8u_P3R, I'm not getting the expected results. Here is a very simplified example of what I'm doing:

Ipp8u x1[8*8], x2[8*8], x3[8*8], y1[16*16], y2[16*16], y3[16*16];
IppiSize srcsz={8,8}, dstroi={16,16};
IppiRect srcroi={0,0,8,8};
IppiSize roi = {8,8};
int i,j,n;
for( i=0; i<8; i++ ) {
ippiSet_8u_C1R( (Ipp8u) (i), x1+8*i+i, 8, roi );
ippiSet_8u_C1R( (Ipp8u) (i+1), x2+8*i+i, 8, roi );
ippiSet_8u_C1R( (Ipp8u) (i+2), x3+8*i+i, 8, roi );
roi.width--;
roi.height--; }

// Gives x1={ 0 0 0 0 0 0 0 0
0 1 1 1 1 1 1 1
0 1 2 2 2 2 2 2
0 1 2 3 3 3 3 3
0 1 2 3 4 4 4 4
0 1 2 3 4 5 5 5
0 1 2 3 4 5 6 6
0 1 2 3 4 5 6 7};

// All the values of x2 are those of x1, incremented by 1, and those of x3 are x1 incremented by 2

Ipp8u pSrc[3]={x1, x2, x3};
Ipp8u pDst[3]= {y1, y2, y3};
ippiResize_8u_P3R( pSrc, srcsz, 8, srcroi, pDst, 16, dstroi, 2, 2, IPPI_INTER_LINEAR );
printf("\\n\\n\\n");
for (i=0; i<16; ++i)
{
for (j=0; j<16; ++j)
{
printf("%d ", y1[i*16+j]);
}
printf("\\n");
}

// I was expecting y1= { 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1
0 0 1 1 2 2 2 2 2 2 2 2 2 2 2 2
0 0 1 1 2 2 2 2 2 2 2 2 2 2 2 2
0 0 1 1 2 2 3 3 3 3 3 3 3 3 3 3
0 0 1 1 2 2 3 3 3 3 3 3 3 3 3 3
0 0 1 1 2 2 3 3 4 4 4 4 4 4 4 4
0 0 1 1 2 2 3 3 4 4 4 4 4 4 4 4
0 0 1 1 2 2 3 3 4 4 4 5 5 5 5 5
0 0 1 1 2 2 3 3 4 4 5 5 5 5 5 5
0 0 1 1 2 2 3 3 4 4 5 5 5 6 6 6
0 0 1 1 2 2 3 3 4 4 5 5 6 6 6 6
0 0 1 1 2 2 3 3 4 4 5 5 6 6 6 7
0 0 1 1 2 2 3 3 4 4 5 5 6 6 7 7 };


Thanks for your help.

Best regards.
0 Kudos
1 Reply
Highlighted
Beginner
2 Views

Ok I've found my mistake:

Ipp8u x1[8*8], x2[8*8], x3[8*8], y1[16*16], y2[16*16], y3[16*16];
IppiSize srcsz={8,8}, dstroi={16,16};
IppiRect srcroi={0,0,8,8};
IppiSize roi = {8,8};
int i,j,n;
for( i=0; i<8; i++ ) {
ippiSet_8u_C1R( (Ipp8u) (i), x1+8*i+i, 8, roi );
ippiSet_8u_C1R( (Ipp8u) (i+1), x2+8*i+i, 8, roi );
ippiSet_8u_C1R( (Ipp8u) (i+2), x3+8*i+i, 8, roi );
roi.width--;
roi.height--; }

Ipp8u* pSrc[3]={x1, x2, x3}; // Here was the mistake
Ipp8u* pDst[3]= {y1, y2, y3}; // Here was the mistake
ippiResize_8u_P3R( pSrc, srcsz, 8, srcroi, pDst, 16, dstroi, 2, 2, IPPI_INTER_LINEAR );
printf("\n\n\n");
for (i=0; i<16; ++i)
{
for (j=0; j<16; ++j)
{
printf("%d ", pDst[1][i*16+j]); // Here was the mistake
}
printf("\n");
}
0 Kudos