HoughCircles参数来识别球 [英] HoughCircles Parameters to recognise balls

查看:111
本文介绍了HoughCircles参数来识别球的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过将图像转换为灰度然后模糊处理图像之后,我尝试使用具有以下参数的霍夫圆变换:

After processing an image by converting it to grey scale and then blurring it, I'm trying to apply a Hough Circle Transformation with these parameters:

  • CV_HOUGH_GRADIENT
  • dp = 1
  • min_dist = 1
  • param_1 = 70
  • param_2 = 100
  • min_radius = 0
  • max_radius = 0

这是我尝试过的众多图像之一: http://i.stack.imgur.com/JGRiM.jpg

Here is one of the many images I've tried: http://i.stack.imgur.com/JGRiM.jpg

但是即使使用宽松的参数,该算法也无法识别出球.

But the algorithm fails to recognise the ball even with relaxed parameters.

(当我尝试使用GIMP中创建的圆的图像尝试时,效果很好)

(When I try it with an image of a circle created in GIMP it works fine)

推荐答案

我同意krzych. 我毫不费力地使用它:

I agree with krzych. I had it working effortlessly with :

cv::Mat img,img2;
std::vector<cv::Vec3f> circles;
img = cv::imread("JGRiM.jpg",1);
cv::bilateralFilter(img, img2, 15, 1000, 1000);
cv::cvtColor(img2, img2,CV_BGR2GRAY);
cv::HoughCircles(img2, circles, CV_HOUGH_GRADIENT, 1,300,50, 10);
cv::circle(img2,cv::Point(circles[0][0],circles[0][1]),circles[0][2],cv::Scalar(126),2);
cv::imshow("test",img2);

cv::waitKey(0);
cv::imwrite("test.jpg",img2);
return 0;

祝你好运:)

这篇关于HoughCircles参数来识别球的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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