<?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 ippiSampleLine not working as expected in Intel® Integrated Performance Primitives</title>
    <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779599#M1461</link>
    <description>Hi,&lt;BR /&gt;Line lenght in pixels depend on starting and ending points and no more than"max(|pt2.x - pt1.x| + 1, |pt2.y - pt1.y| + 1)". In your case for 40 deg line its length in pixels is 85 so elements in"line_data" with indexes [85,11) stay unchanged. In elements [0,84] stored source image pixels values belonged to the rasterized line.&lt;BR /&gt;&lt;BR /&gt;Igor S. Belyakov</description>
    <pubDate>Fri, 10 Sep 2010 13:33:50 GMT</pubDate>
    <dc:creator>Igor_B_Intel1</dc:creator>
    <dc:date>2010-09-10T13:33:50Z</dc:date>
    <item>
      <title>ippiSampleLine not working as expected</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779598#M1460</link>
      <description>&lt;DIV id="_mcePaste"&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was hoping to get a little help on why the &lt;B&gt;&lt;SPAN style="text-decoration: underline;"&gt;ippiSampleLine_8uC1R&lt;/SPAN&gt;&lt;/B&gt; routine is behaving strangely in my code.  I am developing an application for which one of the processing is finding the center of a circle/ellipse in an image.  I want to write code to extract line information of fixed length at various angles from the image center.  For this, I first wanted to familiarize myself with the use of ippiSampleLine_8uC1R function, and am using a 256x256, 8bit, grayscale, synthetic data (&lt;SPAN style="text-decoration: underline;"&gt;attached .raw&lt;/SPAN&gt;) to begin with.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;What I observe is that for horizontal and vertical lines (0, 90, 180 &amp;amp; 270 deg) the output is exactly as expected.  But for any other angle lines (e.g. 20, 40, 60 deg, etc. in my code), the line profile data extracted from the image seems very "squeezed" (attached excel data sheet), and there are lots of initialized values (0's in my case) at the end of the line buffer&lt;/SPAN&gt;.  I am comparing the results of the ippiSampleLine_8uC1R function with line profile capabilities of ImageJ (or any other image analysis software can be used).&lt;/P&gt;&lt;P&gt;For my image (&lt;SPAN style="text-decoration: underline;"&gt;attached .bmp&lt;/SPAN&gt;), the e.g. 40 deg. line is from -- &lt;SPAN style="text-decoration: underline;"&gt;Start pix: (128, 128) &amp;amp; End pix: (212, 198)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Can anyone offer any ideas why this routine would give such unexpected results?  Any help quickly would be deeply appreciated.&lt;/P&gt;&lt;P&gt;Thanks in advance,&lt;/P&gt;&lt;P&gt;GC&lt;/P&gt;&lt;P&gt;/*********************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;Here is the core function.  You can find the full working code in the attached circle_detect.c file&lt;/P&gt;&lt;P&gt;/*********************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;void circle_detect( char* img_path )&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;	my_img  	img;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	IppiPoint 	start_pix = {-1, -1};&lt;/P&gt;&lt;P&gt;	IppiPoint 	end_pix = {-1, -1};&lt;/P&gt;&lt;P&gt;	void*		line_data = NULL;&lt;/P&gt;&lt;P&gt;	int			num_ele = 0;&lt;/P&gt;&lt;P&gt;	int 		theta_deg = 0;&lt;/P&gt;&lt;P&gt;	double 		theta_rad = 0.0;&lt;/P&gt;&lt;P&gt;	int 		rad_pix = 0;&lt;/P&gt;&lt;P&gt;	int 		img_mid = 0;&lt;/P&gt;&lt;P&gt;	int 		i = 0;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	//Create &amp;amp; initialize img&lt;/P&gt;&lt;P&gt;	img.size.width		= 256;&lt;/P&gt;&lt;P&gt;	img.size.height	= 256;&lt;/P&gt;&lt;P&gt;	img.step			= img.size.width * sizeof(Ipp8u);&lt;/P&gt;&lt;P&gt;	img.data			= ippMalloc(img.size.height * img.size.width * sizeof(Ipp8u));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	//Read the image&lt;/P&gt;&lt;P&gt;	iret = read_data_raw( img_path, img.data, img.size.width * img.size.height * sizeof(Ipp8u) );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	rad_pix = 110;&lt;/P&gt;&lt;P&gt;	img_mid = 128;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	//Line data: Need memory for at least (num of pixels + 1)&lt;/P&gt;&lt;P&gt;	num_ele = rad_pix + 1;&lt;/P&gt;&lt;P&gt;	line_data = ippsMalloc_8u(num_ele);	&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	for( theta_deg = 0; theta_deg &amp;lt; 360; theta_deg += 20 )&lt;/P&gt;&lt;P&gt;	{&lt;/P&gt;&lt;P&gt;		theta_rad = (3.142/180.0) * theta_deg;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;		start_pix.x = img_mid;&lt;/P&gt;&lt;P&gt;		start_pix.y = img_mid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;		end_pix.x = (rad_pix * cos(theta_rad)) + img_mid;&lt;/P&gt;&lt;P&gt;		end_pix.y = (rad_pix * sin(theta_rad)) + img_mid;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;		printf("Ang: %d, Start pix: (%d, %d), End pix: (%d, %d)\\n", theta_deg, start_pix.x, start_pix.y, end_pix.x, end_pix.y);	&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;		//Line data: Extract line of data from the image&lt;/P&gt;&lt;P&gt;		FuncStat = ippsSet_8u( IPP_MIN_8U, line_data, num_ele );&lt;/P&gt;&lt;P&gt;		FuncStat = ippiSampleLine_8u_C1R( img.data, img.step, img.size, line_data, start_pix, end_pix );&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;		for(i=0; i&lt;NUM_ELE&gt;&lt;/NUM_ELE&gt;&lt;/P&gt;&lt;P&gt;		{&lt;/P&gt;&lt;P&gt;			printf("%03d, ", ((Ipp8u*)line_data)&lt;I&gt;);	&lt;/I&gt;&lt;/P&gt;&lt;P&gt;		}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;		printf("\\n\\n\\n");&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;	ippFree(img.data);	&lt;/P&gt;&lt;P&gt;	ippsFree(line_data);&lt;/P&gt;&lt;P&gt;	img.data = line_data = NULL;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/*********************************************************************************************************************************/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 15 Jul 2010 02:19:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779598#M1460</guid>
      <dc:creator>gau_chau</dc:creator>
      <dc:date>2010-07-15T02:19:04Z</dc:date>
    </item>
    <item>
      <title>ippiSampleLine not working as expected</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779599#M1461</link>
      <description>Hi,&lt;BR /&gt;Line lenght in pixels depend on starting and ending points and no more than"max(|pt2.x - pt1.x| + 1, |pt2.y - pt1.y| + 1)". In your case for 40 deg line its length in pixels is 85 so elements in"line_data" with indexes [85,11) stay unchanged. In elements [0,84] stored source image pixels values belonged to the rasterized line.&lt;BR /&gt;&lt;BR /&gt;Igor S. Belyakov</description>
      <pubDate>Fri, 10 Sep 2010 13:33:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779599#M1461</guid>
      <dc:creator>Igor_B_Intel1</dc:creator>
      <dc:date>2010-09-10T13:33:50Z</dc:date>
    </item>
    <item>
      <title>ippiSampleLine not working as expected</title>
      <link>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779600#M1462</link>
      <description>I havetriedthe code provided by gau_chau. It works asgau_chau's discription.The reasonforthere are lots of initialized values (0's in my case) at the end of the line should be asIgor's explaination.&lt;BR /&gt;&lt;BR /&gt; 40 deg. line is from -- Start pix: (128, 128) &amp;amp; End pix: (212, 198)&lt;BR /&gt;&lt;BR /&gt;so there are about max (212-128 +1, 198-128+1)= 85 points on the line. It is theline as the definition. end_pix.x = (110 * cos(40)) + 128;&lt;BR /&gt;&lt;BR /&gt;but the total lengh of line_data was defined as&lt;BR /&gt;//Line data: Need memory for at least (num of pixels + 1)&lt;BR /&gt;num_ele =110 + 1;&lt;BR /&gt;line_data = ippsMalloc_8u(num_ele);&lt;BR /&gt;so other 111-85 pixel on the line_data memorykeepinitial value 0;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper"&gt;&lt;img src="https://community.intel.com/skins/images/7B13F55A7CE623EF42E69096FA81A3A1/2021_redesign/images/image_not_found.png" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;rad_pix = 110;&lt;BR /&gt;img_mid = 128;&lt;BR /&gt;&lt;BR /&gt;//Line data: Need memory for at least (num of pixels + 1)&lt;BR /&gt;num_ele = rad_pix + 1;&lt;BR /&gt;line_data = ippsMalloc_8u(num_ele);&lt;BR /&gt;&lt;BR /&gt;for( theta_deg = 0; theta_deg &amp;lt; 360; theta_deg += 20 )&lt;BR /&gt;{&lt;BR /&gt;theta_rad = (3.142/180.0) * theta_deg;&lt;BR /&gt;&lt;BR /&gt;start_pix.x = img_mid;&lt;BR /&gt;start_pix.y = img_mid;&lt;BR /&gt;&lt;BR /&gt;end_pix.x = (rad_pix * cos(theta_rad)) + img_mid;&lt;BR /&gt;end_pix.y = (rad_pix * sin(theta_rad)) + img_mid;&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Ying</description>
      <pubDate>Tue, 12 Oct 2010 01:17:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Integrated-Performance/ippiSampleLine-not-working-as-expected/m-p/779600#M1462</guid>
      <dc:creator>Ying_H_Intel</dc:creator>
      <dc:date>2010-10-12T01:17:58Z</dc:date>
    </item>
  </channel>
</rss>

