<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Central moment IPL-IPP conversion in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/Central-moment-IPL-IPP-conversion/m-p/1055540#M24123</link>
    <description>&lt;P&gt;Hello and good day.&lt;/P&gt;

&lt;P&gt;When converting from the old IPL to the IPP library (v8.1) I get strange results for the IPL function for central moment.&lt;/P&gt;

&lt;P&gt;Example code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;	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_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
											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( &amp;amp;pState, hint); 
	// calculate moments
	IppiSize size = {width, height};
	sts = ippiMoments64f_8u_C1R((Ipp8u*)iplIm-&amp;gt;imageData, iplIm-&amp;gt;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, &amp;amp;res_ipp);
	double res_ipl =  iplCentralMoment(iplIm, mOrd, nOrd);
	
	assert(res_ipl == res_ipp);&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;P&gt;Third moment should be zero for an image consisting only of ones.&lt;/P&gt;

&lt;P&gt;IPP: -7.4505805969238281e-009, Good enough&lt;/P&gt;

&lt;P&gt;IPL: -2.0000000074505806, ???&lt;/P&gt;

&lt;P&gt;System details:&lt;/P&gt;

&lt;P&gt;I7-2600, Win7 32bit, IPP8.1SP1.&lt;/P&gt;

&lt;P&gt;Loaded IPP dlls:&lt;/P&gt;

&lt;P&gt;ippccg9-8.1.dll&lt;BR /&gt;
	ippsg9-8.1.dll&lt;BR /&gt;
	ippcvg9-8.1.dll&lt;BR /&gt;
	ippig9-8.1.dll&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 04 Jul 2014 10:00:28 GMT</pubDate>
    <dc:creator>b_k_</dc:creator>
    <dc:date>2014-07-04T10:00:28Z</dc:date>
    <item>
      <title>Central moment IPL-IPP conversion</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Central-moment-IPL-IPP-conversion/m-p/1055540#M24123</link>
      <description>&lt;P&gt;Hello and good day.&lt;/P&gt;

&lt;P&gt;When converting from the old IPL to the IPP library (v8.1) I get strange results for the IPL function for central moment.&lt;/P&gt;

&lt;P&gt;Example code:&lt;/P&gt;

&lt;PRE class="brush:cpp;"&gt;	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_DATA_ORDER_PIXEL, IPL_ORIGIN_TL,
											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( &amp;amp;pState, hint); 
	// calculate moments
	IppiSize size = {width, height};
	sts = ippiMoments64f_8u_C1R((Ipp8u*)iplIm-&amp;gt;imageData, iplIm-&amp;gt;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, &amp;amp;res_ipp);
	double res_ipl =  iplCentralMoment(iplIm, mOrd, nOrd);
	
	assert(res_ipl == res_ipp);&lt;/PRE&gt;

&lt;P&gt;Results:&lt;/P&gt;

&lt;P&gt;Third moment should be zero for an image consisting only of ones.&lt;/P&gt;

&lt;P&gt;IPP: -7.4505805969238281e-009, Good enough&lt;/P&gt;

&lt;P&gt;IPL: -2.0000000074505806, ???&lt;/P&gt;

&lt;P&gt;System details:&lt;/P&gt;

&lt;P&gt;I7-2600, Win7 32bit, IPP8.1SP1.&lt;/P&gt;

&lt;P&gt;Loaded IPP dlls:&lt;/P&gt;

&lt;P&gt;ippccg9-8.1.dll&lt;BR /&gt;
	ippsg9-8.1.dll&lt;BR /&gt;
	ippcvg9-8.1.dll&lt;BR /&gt;
	ippig9-8.1.dll&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jul 2014 10:00:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Central-moment-IPL-IPP-conversion/m-p/1055540#M24123</guid>
      <dc:creator>b_k_</dc:creator>
      <dc:date>2014-07-04T10:00:28Z</dc:date>
    </item>
    <item>
      <title>at the first glance this is</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/Central-moment-IPL-IPP-conversion/m-p/1055541#M24124</link>
      <description>&lt;P&gt;at the first glance this is the problem in IPL which is no longer supported. Please use IPP instead. :)&lt;/P&gt;</description>
      <pubDate>Sat, 05 Jul 2014 06:00:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/Central-moment-IPL-IPP-conversion/m-p/1055541#M24124</guid>
      <dc:creator>Gennady_F_Intel</dc:creator>
      <dc:date>2014-07-05T06:00:12Z</dc:date>
    </item>
  </channel>
</rss>

