Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6713 Discussions

Different output image result between warpAffine and resize

D12
Beginner
673 Views

Hi, i'm using IPPI  2019 to scale down image.

I checked if output image of scale down image is equal between resize (ippiResizeNearest_8u_C3R) and warpAffine (ippiWarpAffineNearest_8u_C3R) functions. I found out that they are equal while scaling down by 2 but not equal when scale down factor is greater than 2, like scale down by 4 and 8.

I expected to have same results while using same interpolation method.

Ay idea for the the difference?

 

 

Regards,
Dudi

 

0 Kudos
7 Replies
Ruqiu_C_Intel
Moderator
596 Views

Hello Dudi,

Thank you for posting your issue.

Can you tell us your IPP version? OS and platform information, etc.? as well as share a simple reproducer?


0 Kudos
D12
Beginner
578 Views

Hi Ruqiu,

I'm using windows 10, and Intel 9 (Intel 2019).

Attached c++ project which you can test it. It gets as input image filename, scale and interpolation. It creates 2 images one by resize and one by warpAffine and save them to the disk to c:\temp folder.  Using compare tool shows visually the differences.

I'm surprised to see that, as it works on output driven method, meaning for every pixel in the target image it calculates the pixel from the source image and set the output pixel value using interpolation.

You can see under ResizeVSWarpAffine\x64\Debug the differences by compare tool for scale of 0.5 and scale of 0.25. The screen shots are called by0.5.jpg and  0.25.jpg (the blue color shows the differences).

By the way, the test application remembers the input arguments, so you just need to press Enter to use these default arguments again.

 

0 Kudos
Ruqiu_C_Intel
Moderator
544 Views

Hi Dudi,

We have reproduced the issue with your sample code. We will further investigation and update here. Thanks.


0 Kudos
D12
Beginner
430 Views

Hi Ruqiu,

any progress or findings on this issue?

0 Kudos
D12
Beginner
422 Views

Hi Ruqiu,,

i found the reason for the different outputs of resize and warpAffine.

if i set the coefficients (as i did below) to do scale from the center of the image then the output images between resize and warpAffine differs.

double coeffs[2][3] = { 0 };
coeffs[0][0] = xScale;
coeffs[0][1] = 0;
coeffs[0][2] = dstCenter.x - coeffs[0][0] * srcCenter.x - coeffs[0][1] * srcCenter.y;
coeffs[1][1] = 0;
coeffs[1][1] = yScale;
coeffs[1][2] = dstCenter.y - coeffs[1][0] * srcCenter.x - coeffs[1][1] * srcCenter.y;

 

But if i set coeffs[0][2] =0 and coeffs[1][2]=0 meaning scaling is not from the center of the image then the output images are the same.

It seems that resize doesn't scale image from the center of the image.

0 Kudos
D12
Beginner
399 Views

I still don't understand...

checking it again with scale of 2 instead of 0.5 shows differences between resize and warpAffine even when coeffs[0][2]=0 or not and coeffs[1][2]=0 or not.

So, my question is still valid for understanding the problem.

 

0 Kudos
Ruqiu_C_Intel
Moderator
61 Views

Hello Dudi,


Thank you for your patient. Have you checked the article here(https://www.intel.com/content/www/us/en/developer/articles/technical/different-approaches-in-intelr-ipp-resize.html) which introduce the difference for Resize and WarpAffine.


Regards,

Ruqiu


0 Kudos
Reply