opencv - 如何找到检测到的圆的顺序?

我的图像中每个圆圈都有几个不同大小的圆圈。我必须找到每个圆圈的半径进行计算,因此我使用了Hough圆圈,并且能够找到检测到的圆圈的半径。因为我有很多不同的圆圈尺寸如何找到哪个半径属于哪个圆?
例如,我有3个圆c1,c2,c3,霍夫检测向我返回3个半径r1,r2,r3,现在我如何才能得到哪个圆属于哪个圆。

最佳答案

OpenCV中的Hough Circle

例如:

vector<Vec3f> circles;

HoughCircles( src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows/8, 200, 100, 0, 0 );

圆对象具有存储在其中的中心点。
x = circles[i][0];
y =circles[i][1];
radius = circles[i][2];

EG:这样会画圆
for( size_t i = 0; i < circles.size(); i++ )
{
   Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
   int radius = cvRound(circles[i][2]);
   // circle center
   circle( src, center, 3, Scalar(0,255,0), -1, 8, 0 );
   // circle outline
   circle( src, center, radius, Scalar(0,0,255), 3, 8, 0 );
 }

https://stackoverflow.com/questions/13272198/

相关文章:

visual-c++ - OpenCv 和 Visual C++ Eyedetection

qt - (Qt)一键单击后无法使用的窗口

windows - OpenCV CVShow图像无法获得焦点

macos - 如何在Mac OS X 10.6.8上安装openCV库

c# - 将EMGUCV VectorOfKeyPoint保存到XML并再次加载

android - OpenCV裁剪功能致命信号11

python - 在opencv中计算python中的轮廓

visual-studio-2008 - 带有cuda MS Visual Studio 2008的

opencv - OpenCV中的对象跟踪

xcode - 使用OpenCV仅检测圆