<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Interfacing IPP with Magick++</title>
	<atom:link href="http://www.kerrywong.com/2009/03/17/interfacing-ipp-with-magick/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerrywong.com/2009/03/17/interfacing-ipp-with-magick/</link>
	<description></description>
	<lastBuildDate>Mon, 06 Feb 2012 08:13:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: chip</title>
		<link>http://www.kerrywong.com/2009/03/17/interfacing-ipp-with-magick/comment-page-1/#comment-34543</link>
		<dc:creator>chip</dc:creator>
		<pubDate>Thu, 02 Jul 2009 00:08:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrywong.com/?p=864#comment-34543</guid>
		<description>the problem was solved. I am forget to include function convert image RGB to GRAY.
 

#include &quot;cv.h&quot;
#include &quot;highgui.h&quot;
#include &quot;ipp.h&quot;
#include 
#include 

char name[] = &quot;lena.jpg&quot;;
void openWindow_8u( Ipp8u *img, IppiSize *size, int nChannels,char *name, int wait );
void closeWindow_8u( char *name );

int main()
{
	IppStatus sts;	
	Ipp8u *ipprgb = NULL;
	Ipp8u *ippgray = NULL;
	Ipp8u *ippedge = NULL; 
	Ipp8u *buffer = NULL;
	Ipp16s *dx, *dy;

	IppiSize imgsize,roi;

	Ipp32f low=8.0f, high =12.0f;
	int size, size1;
	IplImage *img = NULL; 

	int wait=0;
	img = cvLoadImage( name, -1 ); 
	imgsize.width = img-&gt;width; 
	imgsize.height = img-&gt;height; 
	roi.width = img-&gt;width; 
	roi.height = img-&gt;height; 

	ipprgb = ippsMalloc_8u( imgsize.width * imgsize.height * 3 );
	ippgray = ippsMalloc_8u( imgsize.width * imgsize.height );
	ippiCopy_8u_C3R((Ipp8u *) img-&gt;imageData, imgsize.width * 3, ipprgb, imgsize.width * 3, imgsize );
	ippiRGBToGray_8u_C3C1R ( ipprgb, imgsize.width*3, ippgray, imgsize.width, imgsize );

	double t = (double)cvGetTickCount();
	
	sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size);
	sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size1);
	if(size&lt;size1)size=size1;
	ippiCannyGetSize(roi,&amp;size1);
	if (sizewidth; 
	sizeCv.height = size-&gt;height; 
	cvImg = cvCreateImage( sizeCv, IPL_DEPTH_8U, nChannels );
	tmp = ippsMalloc_8u( size-&gt;width * size-&gt;height * nChannels );
	ippiCopy_8u_C3R( img, size-&gt;width * nChannels,
	tmp, size-&gt;width * nChannels, *size );
	cvSetData( cvImg, (void *) tmp, sizeCv.width * nChannels );
	cvNamedWindow( name, 1 ); 
	cvShowImage( name, cvImg ); 
	cvWaitKey( wait ); 
	cvReleaseImage( &amp;cvImg ); 
}
void closeWindow_8u( char *name )
{
	cvDestroyWindow( name ); 
}</description>
		<content:encoded><![CDATA[<p>the problem was solved. I am forget to include function convert image RGB to GRAY.</p>
<p>#include &#8220;cv.h&#8221;<br />
#include &#8220;highgui.h&#8221;<br />
#include &#8220;ipp.h&#8221;<br />
#include<br />
#include </p>
<p>char name[] = &#8220;lena.jpg&#8221;;<br />
void openWindow_8u( Ipp8u *img, IppiSize *size, int nChannels,char *name, int wait );<br />
void closeWindow_8u( char *name );</p>
<p>int main()<br />
{<br />
	IppStatus sts;<br />
	Ipp8u *ipprgb = NULL;<br />
	Ipp8u *ippgray = NULL;<br />
	Ipp8u *ippedge = NULL;<br />
	Ipp8u *buffer = NULL;<br />
	Ipp16s *dx, *dy;</p>
<p>	IppiSize imgsize,roi;</p>
<p>	Ipp32f low=8.0f, high =12.0f;<br />
	int size, size1;<br />
	IplImage *img = NULL; </p>
<p>	int wait=0;<br />
	img = cvLoadImage( name, -1 );<br />
	imgsize.width = img-&gt;width;<br />
	imgsize.height = img-&gt;height;<br />
	roi.width = img-&gt;width;<br />
	roi.height = img-&gt;height; </p>
<p>	ipprgb = ippsMalloc_8u( imgsize.width * imgsize.height * 3 );<br />
	ippgray = ippsMalloc_8u( imgsize.width * imgsize.height );<br />
	ippiCopy_8u_C3R((Ipp8u *) img-&gt;imageData, imgsize.width * 3, ipprgb, imgsize.width * 3, imgsize );<br />
	ippiRGBToGray_8u_C3C1R ( ipprgb, imgsize.width*3, ippgray, imgsize.width, imgsize );</p>
<p>	double t = (double)cvGetTickCount();</p>
<p>	sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size);<br />
	sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size1);<br />
	if(size&lt;size1)size=size1;<br />
	ippiCannyGetSize(roi,&amp;size1);<br />
	if (sizewidth;<br />
	sizeCv.height = size-&gt;height;<br />
	cvImg = cvCreateImage( sizeCv, IPL_DEPTH_8U, nChannels );<br />
	tmp = ippsMalloc_8u( size-&gt;width * size-&gt;height * nChannels );<br />
	ippiCopy_8u_C3R( img, size-&gt;width * nChannels,<br />
	tmp, size-&gt;width * nChannels, *size );<br />
	cvSetData( cvImg, (void *) tmp, sizeCv.width * nChannels );<br />
	cvNamedWindow( name, 1 );<br />
	cvShowImage( name, cvImg );<br />
	cvWaitKey( wait );<br />
	cvReleaseImage( &amp;cvImg );<br />
}<br />
void closeWindow_8u( char *name )<br />
{<br />
	cvDestroyWindow( name );<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: chip</title>
		<link>http://www.kerrywong.com/2009/03/17/interfacing-ipp-with-magick/comment-page-1/#comment-34515</link>
		<dc:creator>chip</dc:creator>
		<pubDate>Wed, 01 Jul 2009 09:18:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrywong.com/?p=864#comment-34515</guid>
		<description>HI,
nice tutorial.
I tried canny detector using IPP with highGUI opencv, but the output was unexpected.
here is the code:
#include &quot;cv.h&quot;
#include &quot;highgui.h&quot;
#include &quot;ipp.h&quot;
#include 
// file example.bmp in our images directory
char name[] = &quot;baboon.jpg&quot;;
// functions defined after main()
void openWindow_8u( Ipp8u *img, IppiSize *size, int nChannels,char *name, int wait );
void closeWindow_8u( char *name );
int main()
{
IppStatus sts;	
// define Ipp8u image pointer rgb
Ipp8u *ipprgb = NULL;  
Ipp8u *dst = NULL; Ipp8u *buffer = NULL;
Ipp16s *dx, *dy;

// size of our images
IppiSize imgsize,roi;

Ipp32f low=30.0f, high =100.0f;
int size, size1, srcStep, dxStep, dyStep, dstStep;
// pointers to our result images
Ipp8u *ippxyz = NULL, *ipphls = NULL, *ippluv = NULL;
IplImage* img = NULL; // new IplImage structure img

int i = 0, j = 0, wait=0;
img = cvLoadImage( name, -1 ); // load a BMP ipprgb image into img
imgsize.width = img-&gt;width; // size of IPP images is the same
imgsize.height = img-&gt;height; // as read image img
roi.width = img-&gt;width; // *********************
roi.height = img-&gt;height; // *********************
// memory allocation for rgb
ipprgb = ippsMalloc_8u( imgsize.width * imgsize.height * 3 );

// the pointer of our OpenCV data is our IPP image pointer
ippiCopy_8u_C3R((Ipp8u *) img-&gt;imageData, imgsize.width * 3, ipprgb, imgsize.width * 3, imgsize );

sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size);//*********************
sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size1);//***********************
if(size&lt;size1)size=size1;//**********
ippiCannyGetSize(roi,&amp;size1);//**************
if (size&lt;size1) size=size1;//******************
buffer = ippsMalloc_8u(size);//*******************
dx = ippsMalloc_16s(size);//******
dy = ippsMalloc_16s(size);//********
dst = ippsMalloc_8u(size);//********
sts = ippiFilterSobelNegVertBorder_8u16s_C1R (ipprgb, (imgsize.width*3+2), dx, (imgsize.width+2)*2  ,roi, ippMskSize3x3, ippBorderRepl, 0, buffer);
sts = ippiFilterSobelHorizBorder_8u16s_C1R(ipprgb, (imgsize.width*3+2 ), dy, (imgsize.width+2 )*2  ,roi, ippMskSize3x3, ippBorderRepl, 0, buffer);
sts = ippiCanny_16s8u_C1R(dx,(imgsize.width+2)*2 , dy, (imgsize.width+2)*2 , dst, (imgsize.width), roi, low, high, buffer);
ippsFree(buffer);

openWindow_8u( dst, &amp;roi, 1, &quot;dest&quot;, 0 ); // display xyz image
openWindow_8u( ipprgb, &amp;imgsize, 3, &quot;rgb&quot;, 0 ); // display rgb image


cvWaitKey( wait ); // wait for key (==0) or wait milliseconds

closeWindow_8u( &quot;dest&quot; ); // close luv image
closeWindow_8u( &quot;rgb&quot; ); // close rgb image
ippsFree( ipprgb ); // memory release with IPP
ippsFree( dst ); // memory release with IPP
cvReleaseImage( &amp;img ); // memory release with OpenCV
return( 0 );
}

thanks for help!

regards.</description>
		<content:encoded><![CDATA[<p>HI,<br />
nice tutorial.<br />
I tried canny detector using IPP with highGUI opencv, but the output was unexpected.<br />
here is the code:<br />
#include &#8220;cv.h&#8221;<br />
#include &#8220;highgui.h&#8221;<br />
#include &#8220;ipp.h&#8221;<br />
#include<br />
// file example.bmp in our images directory<br />
char name[] = &#8220;baboon.jpg&#8221;;<br />
// functions defined after main()<br />
void openWindow_8u( Ipp8u *img, IppiSize *size, int nChannels,char *name, int wait );<br />
void closeWindow_8u( char *name );<br />
int main()<br />
{<br />
IppStatus sts;<br />
// define Ipp8u image pointer rgb<br />
Ipp8u *ipprgb = NULL;<br />
Ipp8u *dst = NULL; Ipp8u *buffer = NULL;<br />
Ipp16s *dx, *dy;</p>
<p>// size of our images<br />
IppiSize imgsize,roi;</p>
<p>Ipp32f low=30.0f, high =100.0f;<br />
int size, size1, srcStep, dxStep, dyStep, dstStep;<br />
// pointers to our result images<br />
Ipp8u *ippxyz = NULL, *ipphls = NULL, *ippluv = NULL;<br />
IplImage* img = NULL; // new IplImage structure img</p>
<p>int i = 0, j = 0, wait=0;<br />
img = cvLoadImage( name, -1 ); // load a BMP ipprgb image into img<br />
imgsize.width = img-&gt;width; // size of IPP images is the same<br />
imgsize.height = img-&gt;height; // as read image img<br />
roi.width = img-&gt;width; // *********************<br />
roi.height = img-&gt;height; // *********************<br />
// memory allocation for rgb<br />
ipprgb = ippsMalloc_8u( imgsize.width * imgsize.height * 3 );</p>
<p>// the pointer of our OpenCV data is our IPP image pointer<br />
ippiCopy_8u_C3R((Ipp8u *) img-&gt;imageData, imgsize.width * 3, ipprgb, imgsize.width * 3, imgsize );</p>
<p>sts = ippiFilterSobelNegVertGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size);//*********************<br />
sts = ippiFilterSobelHorizGetBufferSize_8u16s_C1R(roi, ippMskSize3x3, &amp;size1);//***********************<br />
if(size&lt;size1)size=size1;//**********<br />
ippiCannyGetSize(roi,&amp;size1);//**************<br />
if (size&lt;size1) size=size1;//******************<br />
buffer = ippsMalloc_8u(size);//*******************<br />
dx = ippsMalloc_16s(size);//******<br />
dy = ippsMalloc_16s(size);//********<br />
dst = ippsMalloc_8u(size);//********<br />
sts = ippiFilterSobelNegVertBorder_8u16s_C1R (ipprgb, (imgsize.width*3+2), dx, (imgsize.width+2)*2  ,roi, ippMskSize3x3, ippBorderRepl, 0, buffer);<br />
sts = ippiFilterSobelHorizBorder_8u16s_C1R(ipprgb, (imgsize.width*3+2 ), dy, (imgsize.width+2 )*2  ,roi, ippMskSize3x3, ippBorderRepl, 0, buffer);<br />
sts = ippiCanny_16s8u_C1R(dx,(imgsize.width+2)*2 , dy, (imgsize.width+2)*2 , dst, (imgsize.width), roi, low, high, buffer);<br />
ippsFree(buffer);</p>
<p>openWindow_8u( dst, &amp;roi, 1, &quot;dest&quot;, 0 ); // display xyz image<br />
openWindow_8u( ipprgb, &amp;imgsize, 3, &quot;rgb&quot;, 0 ); // display rgb image</p>
<p>cvWaitKey( wait ); // wait for key (==0) or wait milliseconds</p>
<p>closeWindow_8u( &quot;dest&quot; ); // close luv image<br />
closeWindow_8u( &quot;rgb&quot; ); // close rgb image<br />
ippsFree( ipprgb ); // memory release with IPP<br />
ippsFree( dst ); // memory release with IPP<br />
cvReleaseImage( &amp;img ); // memory release with OpenCV<br />
return( 0 );<br />
}</p>
<p>thanks for help!</p>
<p>regards.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andriy M</title>
		<link>http://www.kerrywong.com/2009/03/17/interfacing-ipp-with-magick/comment-page-1/#comment-32740</link>
		<dc:creator>Andriy M</dc:creator>
		<pubDate>Thu, 28 May 2009 00:40:45 +0000</pubDate>
		<guid isPermaLink="false">http://www.kerrywong.com/?p=864#comment-32740</guid>
		<description>Thanks for sharing this,

I think your reading and writing from IPP has an error. 
While converting from a standard image file, you should use

imgCache[column + row * stepByte/sizeof(Ipp8u)] = (char) i;
instead of 
imgCache[column + row * width] = (char) i;

The stebByte is a number of bytes between the horizontal lines (as allocated by ippiMalloc_8u_C1).
This number may or may not be equal to the width.(even though you specify height and width).

For the Ipp8u type, size(Ipp8u)=1, so the stepByte/sizeof(Ipp8u) is slightly redundant.

In my problem I used Ipp32f type so I had to use stepByte/sizeof(Ipp32f).
I used ippiMalloc_32f_C1(width,height, &amp;stepByte); to allocate memory.
It turned out that stepByte/sizeof(Ipp32f) is slightly longer than actually image width.

I wonder why? Perhaps ippiMalloc allocates aligned memory for faster memory access, which
can be slightly larger than actual image. If anybody can comment on this, I&#039;d appreciate!

Then when performing any operation,e.g. Sobel filter, you should use stepByte as a length
between lines, instead of width.

Any comments appreciated, thanks</description>
		<content:encoded><![CDATA[<p>Thanks for sharing this,</p>
<p>I think your reading and writing from IPP has an error.<br />
While converting from a standard image file, you should use</p>
<p>imgCache[column + row * stepByte/sizeof(Ipp8u)] = (char) i;<br />
instead of<br />
imgCache[column + row * width] = (char) i;</p>
<p>The stebByte is a number of bytes between the horizontal lines (as allocated by ippiMalloc_8u_C1).<br />
This number may or may not be equal to the width.(even though you specify height and width).</p>
<p>For the Ipp8u type, size(Ipp8u)=1, so the stepByte/sizeof(Ipp8u) is slightly redundant.</p>
<p>In my problem I used Ipp32f type so I had to use stepByte/sizeof(Ipp32f).<br />
I used ippiMalloc_32f_C1(width,height, &amp;stepByte); to allocate memory.<br />
It turned out that stepByte/sizeof(Ipp32f) is slightly longer than actually image width.</p>
<p>I wonder why? Perhaps ippiMalloc allocates aligned memory for faster memory access, which<br />
can be slightly larger than actual image. If anybody can comment on this, I&#8217;d appreciate!</p>
<p>Then when performing any operation,e.g. Sobel filter, you should use stepByte as a length<br />
between lines, instead of width.</p>
<p>Any comments appreciated, thanks</p>
]]></content:encoded>
	</item>
</channel>
</rss>

