Community
cancel
Showing results for 
Search instead for 
Did you mean: 
harihar_n
Beginner
82 Views

WarpAffine and ROI specification

Hi,

I have an image that is being warped using an affine transformation. When using the GetAffineBound function to calculate the destination ROI, I get negative pixel coordinates for the left corner. However if I specify the negative pixels in the dstROI parameter in warpAffine, I get a ippStsSizeErr because one of the entries in the dstROI is negative. How can I get the whole image transformed in this case where the transformation causes the destination coordinates to be negative ?

Thanks!
0 Kudos
1 Reply
Chao_Y_Intel
Employee
82 Views


Hi,

Could you post your code/image here? so we can review it and see if there is any problem.

I had some simple code that demontrate the funtion usage before. Hope it can provide some help.

Thanks,
Chao


void testfunction()
{
Ipp8u x[8*8]={0};
Ipp8u y[8*8]={0};
IppiRect rect = {0,0,4,4};
IppiRect dstRect = {0,0,4,2};

IppiSize sz = {8,8}, roi = {4,4};
double quad[4][2];
double bound[2][2];

const double coeffs[2][3]={{1,0,2},{0,1,0}};

ippiSet_8u_C1R( 10, x, 8,roi );

ippiGetAffineQuad(rect, quad,coeffs);
ippiGetAffineBound(rect,bound,coeffs);
ippiWarpAffine_8u_C1R(x,sz, 8, rect, y,8,dstRect, coeffs,IPPI_INTER_NN);


}

Here, the data for X is:
10 10 10 10 0 0 0 0
10 10 10 10 0 0 0 0
10 10 10 10 0 0 0 0
10 10 10 10 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
...........

This affine transform is to move data in source image to left by 2.

So after calling ippiGetAffineQuad(rect, quad,coeffs), we get quad data:
2, 0
5, 0
5, 3,
2, 3

Because ROI for Y is {0,0,4,2}, So Y data is:
0 0 10 10 0 0 0 0
0 0 10 10 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
...........

Reply