<?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 IppiPyramid with 32f in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773998#M1031</link>
    <description>Thank you Ying!</description>
    <pubDate>Tue, 07 Aug 2012 15:22:23 GMT</pubDate>
    <dc:creator>Ryan2</dc:creator>
    <dc:date>2012-08-07T15:22:23Z</dc:date>
    <item>
      <title>IppiPyramid with 32f</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773995#M1028</link>
      <description>Hi.&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Unfotunately, all the examples for Optical flow are using 8u images. The problem I'm having is that the IppiPyramid struct contains 8u Image pointers and I'm using 32f images. I found a thread&lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=68034&amp;amp;o=a&amp;amp;s=lr"&gt;http://software.intel.com/en-us/forums/showthread.php?t=68034&amp;amp;o=a&amp;amp;s=lr&lt;/A&gt;that discusses this; however, the answer is not really helpful.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;How do I perform optical flow on 32bit images?&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;[cpp]	IppiPyramid *pPyr1;
	IppiPyramid *pPyr2;
	IppiOptFlowPyrLK *pOF;
	
	ippiPyramidInitAlloc (&amp;amp;pPyr1, num_levels, ROI, rate);	
	ippiPyramidInitAlloc (&amp;amp;pPyr2, num_levels, ROI, rate);

	IppiPyramidDownState_32f_C1R** pState1 = (IppiPyramidDownState_32f_C1R**)&amp;amp;(pPyr1-&amp;gt;pState);
	IppiPyramidDownState_32f_C1R** pState2 = (IppiPyramidDownState_32f_C1R**)&amp;amp;(pPyr2-&amp;gt;pState);

	Ipp32f** pImg1 = (Ipp32f**)pPyr1-&amp;gt;pImage;
	Ipp32f** pImg2 = (Ipp32f**)pPyr2-&amp;gt;pImage;

	int *pStep1 = pPyr1-&amp;gt;pStep;
	int *pStep2 = pPyr2-&amp;gt;pStep;

	IppiSize *pRoi1 = pPyr1-&amp;gt;pRoi;
	IppiSize *pRoi2 = pPyr2-&amp;gt;pRoi;

	IppHintAlgorithm hint=ippAlgHintFast;

	int i;
	int level = pPyr1-&amp;gt;level;

	ippiPyramidLayerDownInitAlloc_32f_C1R(pState1, ROI, rate, pKernel, kerSize, IPPI_INTER_LINEAR);
	ippiPyramidLayerDownInitAlloc_32f_C1R(pState2, ROI, rate, pKernel, kerSize, IPPI_INTER_LINEAR);

	pImg1[0]  = Img1Ptr; //32f image
	pImg2[0]  = Img2Ptr;//32f image

	pStep1[0] = Img1StepBytes;//32f image
	pStep2[0] = Img2StepBytes;//32f image

	pRoi1[0]  = pRoi2[0] = ROI;

        // error C2440: '=' : cannot convert from 'Ipp32f *' to 'Ipp8u *'
	for (i = 1; i &amp;lt;= level; i++) 
	{
	   pPyr1-&amp;gt;pImage&lt;I&gt; = (Ipp32f*)ippiMalloc_32f_C1(pRoi1&lt;I&gt;.width, pRoi1&lt;I&gt;.height, pStep1 + i * sizeof(Ipp32f));
	   pPyr2-&amp;gt;pImage&lt;I&gt; = (Ipp32f*)ippiMalloc_32f_C1(pRoi2&lt;I&gt;.width, pRoi2&lt;I&gt;.height, pStep2 + i * sizeof(Ipp32f));
	   ippiPyramidLayerDown_32f_C1R(pImg1[i-1], pStep1[i-1], pRoi1[i-1], pImg1&lt;I&gt;, pStep1&lt;I&gt;, pRoi1&lt;I&gt;, *pState1);
	   ippiPyramidLayerDown_32f_C1R(pImg2[i-1], pStep2[i-1], pRoi2[i-1], pImg2&lt;I&gt;, pStep2&lt;I&gt;, pRoi2&lt;I&gt;, *pState2);
	}[/cpp] &lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I've tried to simply cast the pointers to 32f but I'm getting an error. If I just cast that to Ipp8u, the memory location should still be the same which should fix the error. How do I setpStep1?? Would it not be set to 8u spacing byippiPyramidInitAlloc?&lt;/DIV&gt;</description>
      <pubDate>Fri, 03 Aug 2012 13:53:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773995#M1028</guid>
      <dc:creator>Ryan2</dc:creator>
      <dc:date>2012-08-03T13:53:23Z</dc:date>
    </item>
    <item>
      <title>IppiPyramid with 32f</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773996#M1029</link>
      <description>ippiPyramidLayerDown_32f_C1R(pImg2[i-1], pStep2[i-1], pRoi2[i-1], pImg2&lt;I&gt;, pStep2&lt;I&gt;, pRoi2&lt;I&gt;, *pState2);&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;This is returning ippStsStepErr = -14,  /* Step value is not valid. */&lt;/DIV&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;</description>
      <pubDate>Fri, 03 Aug 2012 15:08:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773996#M1029</guid>
      <dc:creator>Ryan2</dc:creator>
      <dc:date>2012-08-03T15:08:03Z</dc:date>
    </item>
    <item>
      <title>IppiPyramid with 32f</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773997#M1030</link>
      <description>Hi Ryan, &lt;BR /&gt;&lt;BR /&gt;You can refer to the example code in IPP reference manual, which is using ippiRyramid with 32f.&lt;BR /&gt; &lt;A&gt;Example14-6&lt;/A&gt; shows how different general pyramids functions can be used to create the Gaussian and Laplacian pyramids: ( I attached it at the end of message). &lt;BR /&gt;&lt;BR /&gt;For example, please note the code i mark as Bold. &lt;BR /&gt;1) Regarding "The IppiPyramid contains pointers to 8 bit unsigned Images", Please see the structure,&lt;BR /&gt;typedef struct _IppiPyramid {&lt;BR /&gt; &lt;STRONG&gt;Ipp8u **pImage;&lt;BR /&gt;&lt;/STRONG&gt; IppiSize *pRoi;&lt;BR /&gt; Ipp64f *pRate;&lt;BR /&gt; int *pStep;&lt;BR /&gt; Ipp8u *pState;&lt;BR /&gt; int level;&lt;BR /&gt;} IppiPyramid;&lt;BR /&gt;&lt;BR /&gt;Here the pionteris actually ** pointer. And the cost happen in&lt;BR /&gt;Ipp32** pImg1 = (Ipp32f**)pPyr1-&amp;gt;pImage;&lt;BR /&gt;Ipp32f** pImg2 = (Ipp32f**)pPyr2-&amp;gt;pImage;&lt;BR /&gt;&lt;BR /&gt;And then use the pointer array pImg1[] instead of pPyr1-&amp;gt;pImage. &lt;BR /&gt;&lt;BR /&gt;for (i = 1; i &amp;lt;= level; i++)&lt;BR /&gt;{&lt;BR /&gt; &lt;STRONG&gt;pImg1&lt;I&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt; = ippiMalloc_32f_C1(pRoi1&lt;I&gt;.width, pRoi1&lt;I&gt;.height, &lt;STRONG&gt;pStep1 + i&lt;/STRONG&gt;);//(Ipp32f*)&lt;BR /&gt; pImg2&lt;I&gt; = ippiMalloc_32f_C1(pRoi2&lt;I&gt;.width, pRoi2&lt;I&gt;.height, pStep2 + i);//(Ipp32f*)&lt;BR /&gt; sts = ippiPyramidLayerDown_32f_C1R(pImg1[i-1], pStep1[i-1], pRoi1[i-1], pImg1&lt;I&gt;, pStep1&lt;I&gt;, pRoi1&lt;I&gt;, *pState1);&lt;BR /&gt; sts = ippiPyramidLayerDown_32f_C1R(pImg2[i-1], pStep2[i-1], pRoi2[i-1], pImg2&lt;I&gt;, pStep2&lt;I&gt;, pRoi2&lt;I&gt;, *pState2);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Regarding the wrong steps, as pStep1 is a pointer, The address ofpStep1[1]=pStep+1 (not related to imagedatatype)&lt;BR /&gt;&lt;BR /&gt;After change the two place, you will get your code work. &lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;Ying &lt;BR /&gt;&lt;H1 class="topictitle1"&gt;&lt;BR /&gt;Example of Using General Pyramid Functions&lt;/H1&gt;&lt;DIV&gt;&lt;P MSHELP="http://www.microsoft.com/MSHelp/"&gt;The following &lt;A&gt;Example14-6&lt;/A&gt; shows how different general pyramids functions can be used to create the Gaussian and Laplacian pyramids: &lt;/P&gt;&lt;DIV class="section" id="ex14-6"&gt;&lt;A MSHELP="http://www.microsoft.com/MSHelp/" name="ex14-6"&gt;&lt;!-- --&gt;&lt;/A&gt;&lt;H2 class="sectiontitle"&gt;Building Gaussian and Laplacian Pyramids &lt;/H2&gt;&lt;P MSHELP="http://www.microsoft.com/MSHelp/"&gt;&lt;/P&gt;&lt;PRE&gt;void UsePyramids(Ipp32f *pSrc, IppiSize srcRoi, int srcStep, Ipp32f *pkernel, int kerSize) {&lt;/PRE&gt;&lt;PRE&gt; float rate = 2.0f;&lt;/PRE&gt;&lt;PRE&gt; IppiPyramid *gPyr; // pointer to Gaussian pyramid structure&lt;/PRE&gt;&lt;PRE&gt; IppiPyramid *lPyr; // pointer to Laplacian pyramid structure&lt;/PRE&gt;&lt;PRE&gt; // allocate pyramid structures&lt;/PRE&gt;&lt;PRE&gt; ippiPyramidInitAlloc (&amp;amp;gPyr, 1000, srcRoi, rate);&lt;/PRE&gt;&lt;PRE&gt; ippiPyramidInitAlloc (&amp;amp;lPyr, 1000, srcRoi, rate);&lt;/PRE&gt;&lt;PRE&gt; {&lt;/PRE&gt;&lt;PRE&gt;   int i;&lt;/PRE&gt;&lt;PRE&gt;   IppiPyramidDownState_32f_C1R **gState = (IppiPyramidDownState_32f_C1R**)&amp;amp;(gPyr-&amp;gt;pState);&lt;/PRE&gt;&lt;PRE&gt;   IppiPyramidUpState_32f_C1R **lState = (IppiPyramidUpState_32f_C1R**) &amp;amp;(lPyr-&amp;gt;pState);&lt;/PRE&gt;&lt;PRE&gt;   &lt;STRONG&gt;Ipp32f **gImage = (Ipp32f**)(gPyr-&amp;gt;pImage);&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE&gt;&lt;STRONG&gt;   Ipp32f **lImage = (Ipp32f**)(lPyr-&amp;gt;pImage);&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE&gt;   IppiSize *pRoi = gPyr-&amp;gt;pRoi;&lt;/PRE&gt;&lt;PRE&gt;   int *gStep = gPyr-&amp;gt;pStep;&lt;/PRE&gt;&lt;PRE&gt;   int *lStep = lPyr-&amp;gt;pStep;&lt;/PRE&gt;&lt;PRE&gt;   int level = gPyr-&amp;gt;level;&lt;/PRE&gt;&lt;PRE&gt;   Ipp32f *ptr;&lt;/PRE&gt;&lt;PRE&gt;   int step;&lt;/PRE&gt;&lt;PRE&gt;   // allocate structures to calculate pyramid layers&lt;/PRE&gt;&lt;PRE&gt;   ippiPyramidLayerDownInitAlloc_32f_C1R
                          (gState, srcRoi, rate, pkernel, kerSize, IPPI_INTER_LINEAR);&lt;/PRE&gt;&lt;PRE&gt;   ippiPyramidLayerUpInitAlloc_32f_C1R 
                          (lState, srcRoi, rate, pkernel, kerSize, IPPI_INTER_LINEAR);&lt;/PRE&gt;&lt;PRE&gt;   // build Gaussian pyramid with level+1 layers&lt;/PRE&gt;&lt;PRE&gt;   gImage[0] = pSrc;&lt;/PRE&gt;&lt;PRE&gt;   gStep[0] = srcStep;&lt;/PRE&gt;&lt;PRE&gt;   for (i=1; i&amp;lt;=level;i++) {&lt;/PRE&gt;&lt;PRE&gt;     &lt;STRONG&gt;gImage&lt;I&gt; = ippiMalloc_32f_C1(pRoi&lt;I&gt;.width,pRoi&lt;I&gt;.height,gStep+i);&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/STRONG&gt;&lt;I&gt;&lt;I&gt;&lt;I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;PRE&gt;     ippiPyramidLayerDown_32f_C1R
                (gImage[i-1], gStep[i-1], pRoi[i-1], gImage&lt;I&gt;, gStep&lt;I&gt;, pRoi&lt;I&gt;, *gState);&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;PRE&gt;   }&lt;/PRE&gt;&lt;PRE&gt;   // build Laplacian pyramid with level layers&lt;/PRE&gt;&lt;PRE&gt;   ptr = ippiMalloc_32f_C1(srcRoi.width,srcRoi.height,&amp;amp;step);&lt;/PRE&gt;&lt;PRE&gt;   for (i=level-1; i&amp;gt;=0; i--) {&lt;/PRE&gt;&lt;PRE&gt;     lImage&lt;I&gt; = ippiMalloc_32f_C1(pRoi&lt;I&gt;.width,pRoi&lt;I&gt;.height,lStep+i);&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;PRE&gt;     ippiPyramidLayerUp_32f_C1R(gImage[i+1], gStep[i+1], pRoi[i+1], ptr, step, pRoi&lt;I&gt;, *lState);&lt;/I&gt;&lt;/PRE&gt;&lt;PRE&gt;     ippiSub_32f_C1R(ptr, step, gImage&lt;I&gt;, gStep&lt;I&gt;, lImage&lt;I&gt;, lStep&lt;I&gt;, pRoi&lt;I&gt;);&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;PRE&gt;   }&lt;/PRE&gt;&lt;PRE&gt;   ippiFree(ptr);&lt;/PRE&gt;&lt;PRE&gt;   ippiPyramidLayerDownFree_32f_C1R(*gState);&lt;/PRE&gt;&lt;PRE&gt;   ippiPyramidLayerUpFree_32f_C1R(*lState);&lt;/PRE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;PRE&gt;   // use Gaussian and Laplacian pyramids&lt;/PRE&gt;&lt;PRE&gt;   // free allocated images&lt;/PRE&gt;&lt;PRE&gt;   for (i=1; i&amp;lt;=level; i++) {&lt;/PRE&gt;&lt;PRE&gt;          ippiFree(gImage&lt;I&gt;);&lt;/I&gt;&lt;/PRE&gt;&lt;PRE&gt;          ippiFree(lImage[i-1]);&lt;/PRE&gt;&lt;PRE&gt;   }&lt;/PRE&gt;&lt;PRE&gt; }&lt;/PRE&gt;&lt;PRE&gt; //  free pyramid structures&lt;/PRE&gt;&lt;PRE&gt; ippiPyramidFree (gPyr);&lt;/PRE&gt;&lt;PRE&gt; ippiPyramidFree (lPyr);&lt;/PRE&gt;&lt;PRE&gt;} &lt;/PRE&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;</description>
      <pubDate>Mon, 06 Aug 2012 07:04:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773997#M1030</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2012-08-06T07:04:45Z</dc:date>
    </item>
    <item>
      <title>IppiPyramid with 32f</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773998#M1031</link>
      <description>Thank you Ying!</description>
      <pubDate>Tue, 07 Aug 2012 15:22:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/IppiPyramid-with-32f/m-p/773998#M1031</guid>
      <dc:creator>Ryan2</dc:creator>
      <dc:date>2012-08-07T15:22:23Z</dc:date>
    </item>
  </channel>
</rss>

