- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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?
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
The exact function name is "WarpAffine" in Image and Video processing. I used IPP version 7.0. Thanks.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I used ippiWarpAffine_32f_C1R for the testing. I used coeffs = {{ { 0.5, 0.0, 0.0}, {0.0, 0.5, 0.0} }; for resize test and coeffs = { { 1.0, 0, 0.0}, {0.5, 1.0, 0.0} };for shear test.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi Valentin,
Can you reproduce the problem I found when using ippiWarpAffine_32f_C1R? Is this a software bug? Thanks.
Annie
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi Annie,
I was on vacation and now I am investigating this issue.
Regards, Valentin
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable