Note that there are some explanatory texts on larger screens.

plurals
  1. POHough Transform: improving algorithm efficiency over OpenCL
    primarykey
    data
    text
    <p>I am trying to detect a circle in binary image using hough transform. </p> <p>When I use Opencv's built-in function for the circular hough transform, it is OK and I can find the circle.</p> <p>Now I try to write my own 'kernel' code for doing hough transform but is very very slow: </p> <pre><code> kernel void hough_circle(read_only image2d_t imageIn, global int* in,const int w_hough,__global int * circle) { sampler_t sampler=CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST; int gid0 = get_global_id(0); int gid1 = get_global_id(1); uint4 pixel; int x0=0,y0=0,r; int maxval=0; pixel=read_imageui(imageIn,sampler,(int2)(gid0,gid1)); if(pixel.x==255) { for(int r=20;r&lt;150;r+=2) { // int r=100; for(int theta=0; theta&lt;360;theta+=2) { x0=(int) round(gid0-r*cos( (float) radians( (float) theta) )); y0=(int) round(gid1-r*sin( (float) radians( (float) theta) )); if((x0&gt;0) &amp;&amp; (x0&lt;get_global_size(0)) &amp;&amp; (y0&gt;0)&amp;&amp;(y0&lt;get_global_size(1))) atom_inc(&amp;in[w_hough*y0+x0]); } if(maxval&lt;in[w_hough*y0+x0]) { maxval=in[w_hough*y0+x0]; circle[0]=gid0; circle[1]=gid1; circle[2]=r; } } } } </code></pre> <p>There are source codes for the hough opencl library with opencv, but its hard to me for extract a specific function that helps me.</p> <p>Can anyone offer a better source code example, or help me understand why this is so inefficient? the code main.cpp and kernel.cl compress in rar file <a href="http://www.files.com/set/527152684017e" rel="nofollow">http://www.files.com/set/527152684017e</a> use opencv lib for read and display image ></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload