Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Intel Community
- Software
- Software Development SDKs and Libraries
- Intel® Integrated Performance Primitives
- WarpAffine does not properly support linear interpolation

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-01-2013
05:15 PM

94 Views

WarpAffine does not properly support linear interpolation

I used WarpAffine in my application. I found WarpAffine did not properly support linear interpolation except for pure translation. I did the resize {{xFactor, 0.0, 0.0}, {0.0, yFactor, 0.0}} using WarpAffine and got the same result using NN or linear interpolation. I did the same tests for Shear using WarpAffine and also got the same results using NN or linear interpolation.

Could you please let me know if there is an issue with WarpAffine support for different interpolation methods?

Link Copied

13 Replies

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-03-2013
04:50 PM

94 Views

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-05-2013
10:32 AM

94 Views

SergeyKostrov

Valued Contributor II

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-06-2013
06:03 AM

94 Views

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-06-2013
10:12 AM

94 Views

Valentin_K_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-08-2013
02:44 AM

94 Views

Hi anniezh,

Could you please provide sample code with ippiWarpAffine_32f_C1R function usage, and the input/output images for NN and linear interpolation, which were obtained.

Regards, Valentin

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

08-08-2013
11:14 AM

94 Views

Hi Valentin,

Here is the sample code:

octet* pSrc = src_data.get_indexed_offset(0, 0); octet* pDst = dst_data.get_indexed_offset(0, 0);

Imaging::DimensionSize src_dimx = src_data.get_dim_length(0); Imaging::DimensionSize src_dimy = src_data.get_dim_length(1);

IppiSize size_src_xy = {(int) src_dimx, (int) src_dimy}; IppiRect srcROI = {0, 0, (int) src_dimx, (int) src_dimy};

int srcStep = (int) src_data.get_dim_stride(1); // length in bytes of each row (see IPP documentation) int dstStep = (int) dst_data.get_dim_stride(1); // length in bytes of each row (see IPP documentation)

IppiRect dstROI = {0, 0, (int) dst_data.get_dim_length(0), (int) dst_data.get_dim_length(1)};

ippStatus = ippiWarpAffine_32f_C1R((Ipp32f*)pSrc, srcSize, srcStep, srcRoi, (Ipp32f*)pDst, dstStep, dstRoi, coeffs, interpolationType);

One can do the testing by passing different coeffs and interpolationType.

I tried resize using coeffs = { { 0.5, 0.0, 0.0}, {0.0, 0.5, 0.0} }; interpolationType as 1 or 2. Got exactly the same result image.

shear using coeffs = { { 1.0, 0.0, 0.0}, {0.5, 1.0, 0.0} }; interpolationType as 1 or 2. Got exactly the same result image.

Attached please find the images.

Regards,

Annie

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-18-2013
04:21 PM

94 Views

Hi Valentin,

Can you reproduce the problem I found when using ippiWarpAffine_32f_C1R? Is this a software bug? Thanks.

Annie

Valentin_K_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

09-25-2013
04:51 AM

94 Views

Hi Annie,

I was on vacation and now I am investigating this issue.

Regards, Valentin

Valentin_K_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-14-2013
04:28 AM

94 Views

Hi Annie,

Sorry for the delay with the answer. I have investigated this issue. It has turned out that the root cause of the issue consists in the transformation coefficients. If the source indices calculated by the function are integer, the linear interpolation is computed with the coefficients {0,1} that is equal to Nearest Neighbor interpolation.

You can check that the function works with linear interpolation by changing coefficients from { { 0.5, 0.0, 0.0}, {0.0, 0.5, 0.0} } to { { 0.55, 0.0, 0.0}, {0.0, 0.55, 0.0} } for example.

Thanks, Valentin

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-21-2013
11:28 AM

94 Views

Hi Valentin,

Thanks for your reply! I think the interplation type that the function apply should depends on the interplation type that the user pass in, not on the coefficients that the user pass in. The function should work with linear interplation for all coefficients as long as the user choose the interplation type as linear interplation. Please let me know what you think. Thanks.

Annie

Valentin_K_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-29-2013
04:42 AM

94 Views

Hi Annie,

The current function implementation calculates a new position for each pixel by rotation of the top-left pixel corner. This approach gives the same results for nearest neighbor and linear interpolations, if the source image size is multiple of the destination image size.

Best regards, Valentin

anniezh

Beginner

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-29-2013
04:57 PM

94 Views

Hi Valentin,

I tested ippiResizeSqrPixel_32f_C1R to resize the image in half. Use Nearest neighbor vs linear interpolation give different results, while use ippiWarpAffine_32f_C1R to resize the image in half, nearest neighbor and linear interpolation give the same results. Is there something wrong with the WarpAffine calculation? Thanks,

Annie

Valentin_K_Intel

Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

10-31-2013
12:19 PM

94 Views

Hi Annie,

ippiWarpAffine_32f_C1R considers an image as a grid with pixels as nodes, while ResizeSqrPixel considers pixels as "squares". Thus these functions use the different approaches for image transformation.

Best regards, Valentin

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.