Central moment IPL-IPP conversion

Central moment IPL-IPP conversion

Hello and good day.

When converting from the old IPL to the IPP library (v8.1) I get strange results for the IPL function for central moment.

Example code:

	int width = 103; // minimum size for the discrepancy
	int height =2;
	// create unsigned char image (w,h)=(103,2)
	IplImage* iplIm = iplCreateImageHeader(1, 0, IPL_DEPTH_8U, "GRAY", "GRAY",
											IPL_ALIGN_QWORD, width, height,
											NULL, NULL, NULL, NULL);
	// set all pixels to 1.
	iplAllocateImage(iplIm, 1, 1);
	//create ipp state for moments
	IppHintAlgorithm hint = ippAlgHintAccurate;//ippAlgHintAccurate;//ippAlgHintFast;// ippAlgHintNone
	// allocate memory for state
	IppiMomentState_64f* pState;	
	IppStatus sts = ippiMomentInitAlloc_64f( &pState, hint); 
	// calculate moments
	IppiSize size = {width, height};
	sts = ippiMoments64f_8u_C1R((Ipp8u*)iplIm->imageData, iplIm->widthStep, size, pState);

	// get central moment for IPL and IPP
	int mOrd = 3;
	int nOrd = 0;
	double res_ipp;
	sts = ippiGetCentralMoment_64f( pState, mOrd, nOrd, 0, &res_ipp);
	double res_ipl =  iplCentralMoment(iplIm, mOrd, nOrd);
	assert(res_ipl == res_ipp);


Third moment should be zero for an image consisting only of ones.

IPP: -7.4505805969238281e-009, Good enough

IPL: -2.0000000074505806, ???

System details:

I7-2600, Win7 32bit, IPP8.1SP1.

Loaded IPP dlls:


publicaciones de 2 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

at the first glance this is the problem in IPL which is no longer supported. Please use IPP instead. :)

Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya