- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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?
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Hi Annie,
I was on vacation and now I am investigating this issue.
Regards, Valentin
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
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