检测图像中的圆圈 [英] Detecting Circles within an image
问题描述
我目前正在使用EmguCV对靶场图像进行形状检测:
I'm currently using EmguCV to run shape detection on an image of a shooting range target:
但是不管我在代码中的设置(如下):
But no matter my settings in the code (below):
double cannyThreshold = 180;
double circleAccumulatorThreshold = 170;
CircleF[] circles = CvInvoke.HoughCircles(uimage, HoughType.Gradient, 2.0, 1.0, cannyThreshold, circleAccumulatorThreshold, 5);
double cannyThreshold = 180;
double circleAccumulatorThreshold = 170;
CircleF[] circles = CvInvoke.HoughCircles(uimage, HoughType.Gradient, 2.0, 1.0, cannyThreshold, circleAccumulatorThreshold, 5);
我似乎只能找到三个圈子,其中一个是错误的.
I can only seem to find three circles, of which one is wrong.
Am I going about this incorrectly? I'm using the default example for shape detection included with Rev3.0 EmguCV.
推荐答案
- 首先查找边缘(例如,参见Sobel运算符或Canny)
- 找到轮廓,之后轮廓将代表圆形
- 按区域过滤轮廓
- 对每个轮廓使用minEnclosingCircle以获取中心和 半径.
- Find edges first (see Sobel operator or Canny for example)
- Find contours, after that contours will represent circles
- Filter contours by area
- Use minEnclosingCircle for each contour to get center and radius.
这篇关于检测图像中的圆圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!