在不使用Hough变换的情况下在图像中查找圆圈 [英] Find circles in image without using Hough transform

查看:138
本文介绍了在不使用Hough变换的情况下在图像中查找圆圈的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想找到下图中的圆圈。我尝试使用OpenCV的


I want to find the circles in the below image.I tried using OpenCV's Hough circle detection but it is not giving the proper results.

Is there any other way to find circles?

Here is sample code

vector<Vec3f> circles;
Mat src_gray,te; 
cvtColor(tImg, src_gray, CV_BGR2GRAY);
GaussianBlur(src_gray, src_gray, Size(9, 9), 2, 2);
Canny(src_gray, te, 40, 240, 3);
/// Apply the Hough Transform to find the circles 
HoughCircles(te, circles, CV_HOUGH_GRADIENT, 1, te.rows / 10, 120, 9, 5, 25); 

解决方案

Take contour,
1. find the centroid of the contour
2. find distance from the centroid to each contour pixels.
3. if this distance is almost same then it will be a circle.

See This link

这篇关于在不使用Hough变换的情况下在图像中查找圆圈的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆