Ask Your Question
0

Circle Detection

asked 2015-07-28 04:30:32 -0500

Saleh gravatar image

updated 2015-07-28 05:53:48 -0500

Hello! I try to get the center of circles using Hough Circle algoritm from https://github.com/Itseez/opencv/blob... but i need exactly coordinates .When i get those coordinates like this

for( size_t i = 0; i < circles.size(); i++ )
    {
        Vec3i c = circles[i];
       cout<<c[0]<<"  "<<c[1]<<endl;
}

it prints just the integer part. Is there any posibility to get the center more precise(4 decimals or more)?

/// Edit FooBar: Same question on SO: http://stackoverflow.com/questions/31...

edit retag flag offensive close merge delete

Comments

3

your question is incomplete...

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-07-28 04:44:30 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2015-07-28 06:24:45 -0500

updated 2015-07-28 06:26:22 -0500

That is because you are accessing your data incorrectly. Look at the docs of HoughCircles ... It clearly has an example where the circles are stored in a vector<Vec3f> which is floating point accuracy. You are cutting it down by asking for a vector<Vec3i> so you will loose the precision by rounding errors.

So it should be

for( size_t i = 0; i < circles.size(); i++ )
{
       Vec3f c = circles[i];
       cout << c[0] << "  " << c[1] <<endl;
}

And ofcourse you will need to change your HoughCircles command to store the circles in floating point type.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2015-07-28 04:30:32 -0500

Seen: 148 times

Last updated: Jul 28 '15