Ask Your Question

Revision history [back]

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.

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;
}

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.