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

ippiResize produce different result than cvResize using the same interpolation method

Yuriy
Beginner
693 Views
I found that cvResize works different way while Intel IPP is detected.

Please take a look into attached samples:
0.bmp - original image
1.bmp - resized with cvResize without using Intell IPP
2.bmp - resized with cvResize with using Intell IPP
3.bmp - resized using ippiResize_8u_C1R with the same interpolation algorithm
as used for cvResize for image 2.bmp

2 and 3.bmp are exactly same, but 1.bmp differs from them. Probably the reason
in border mode? But, I can't found any notices how I may specify it for ippiResize.

Please advise, how I may get exact the same result as I have with OpenCV using
Intel IPP.

As input data for both code samples I have CvRect on anImage.

Source code for cvResize:
[cpp]CvMat *tMat;
CvMat submat;

tMat = cvGetSubRect((IplImage *)anImage, &submat, cvrect);
cvResize(tMat, (IplImage*)image->img_base, CV_INTER_CUBIC);[/cpp]

Source code for ippiResize:
[cpp]IppStatus ippStatus;
IplImage *srcImage;
IppiSize srcSize, dstSize;
int srcWideStep, dstWideStep;
double xFactor, yFactor;

dstSize.width = image->img_width;
dstSize.height = image->img_height;
dstWideStep = image->img_width * image->img_bpp / 8;

srcImage = (IplImage *)anImage;
srcSize.width = srcImage->width;
srcSize.height = srcImage->height;
srcWideStep = srcImage->widthStep;

assert(0 != cvrect.width && 0 != cvrect.height);

xFactor = (double)dstSize.width / cvrect.width;
yFactor = (double)dstSize.height / cvrect.height;

ippStatus = ippiResize_8u_C1R(
(Ipp8u*)srcImage->imageData, srcSize, srcWideStep, *((IppiRect *)&cvrect),
(Ipp8u*)((IplImage *)image->img_base)->imageData, dstWideStep, dstSize,
xFactor, yFactor, IPPI_INTER_CUBIC
);
assert(ippStsNoErr == ippStatus);
[/cpp]

System specifications:
OpenCV - 1.1
Intel IPP - 6.0.2.074

Core 2 Duo T9300
Windows Vista SP1
Visual Studio 2005

0 Kudos
2 Replies
Yuriy
Beginner
693 Views
Using ippiResizeSqrPixel I got more similar results to native cvResize, but it is still different. Please check attached file.
0 Kudos
Vladimir_Dudnik
Employee
693 Views


Hello,

I would recommend you to look through IPP documentation for details on how to use IPP Resize functions. You also may find discussion thread with attached example code on this forum.

Regards,
Vladimir

0 Kudos
Reply