Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
The Intel sign-in experience has changed to support enhanced security controls. If you sign in, click here for more information.
6670 Discussions

ippiResizeSqrPixel not resizing correctly

This is my first application using the ippiResizeSqrPixel function and I'm have problems with it.

[cpp]SendCurrentImage( int pixelWidth, int pixelHeight, int imageSizeInBytes, const char* image )

	const int sizeOfBufferWindow = 2000000;
	int pixels = sizeOfBufferWindow/4;
	double shapeRatio = (double) pixelWidth / (double) pixelHeight;
	int newWidth = (int) sqrt((double)pixels * shapeRatio);
	int newHieght = pixels / newWidth;

	double scale =  (double) newWidth / (double) pixelWidth ;
	scale = min(1.0, scale);

	IppiRect sourceRoi = {0, 0, pixelWidth, pixelHeight};
	IppiRect destRoi = {0, 0, newWidth, newHieght};
	int bufSize;

	// calc required size of working buffer

	ippiResizeGetBufSize( sourceRoi, destRoi, 4, IPPI_INTER_CUBIC, &bufSize );
	Ipp8u* workingbuff = ippsMalloc_8u( bufSize);

	Ipp8u* destImageBuffer = reinterpret_cast ( &_pData->imageToGui.rawImage[0]);

	IppiSize sourceImageSize;
	sourceImageSize.height = pixelHeight;
	sourceImageSize.width = pixelWidth;

	IppStatus status = ippiResizeSqrPixel_8u_AC4R(reinterpret_cast (image), sourceImageSize, pixelWidth * 4, sourceRoi, 
		destImageBuffer, newWidth * 4,  destRoi ,scale, scale, 0.0, 0.0, IPPI_INTER_CUBIC, workingbuff);
	ippsFree( workingbuff);[/cpp]

Test Condtions - XP32, VS2008, IPP6.1. Source Image is in RGB0 format and image is 6750 pixels wide by 1200 pixels high. When called imageSizeinBytes = 32,400,000. The image is to be resized to 1677 pixels wide by 298 pixels high.

To make things simple, I thought I would try to resize a simple image of a single color - "0xF6F7F800". What I'm getting back after resampling is "F7F80000", but on some I do get the correct value. Just to make things clear (for myself), when I look at the source image "0xF6F7F800", the stored bytes are: byte[0] = 00, byte[1] = 0xF8, byte[2] = F7, byte[3] = 0xF6; then repeats for rest of image.

0 Kudos
1 Reply
Found my problem. I was using ippiResizeSqrPixel_8u_AC4R when I should have been using ippiResizeSqrPixel_8u_C4R.

Sorry to have bothered anyone.