Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
LINUX-opencv-hough变换圆_Opencv_Geometry_Hough Transform - Fatal编程技术网

LINUX-opencv-hough变换圆

LINUX-opencv-hough变换圆,opencv,geometry,hough-transform,Opencv,Geometry,Hough Transform,我使用的代码来自。它适用于我的大多数图像。但在所附的图像上它失败了-代码无法识别仪表的外部刻度盘/边界(在我的原始图像中,没有内部白色圆圈) 你知道会出什么问题吗?这就是你想要的 如果是这样的话,这是一个调整一些参数的问题。特别是最小和最大圆半径以及圆距离(检测到的圆之间的最小距离) 要点 更新 如果要将最小半径与图像尺寸关联,可以执行以下操作: float minRadius = MIN(img.size().width, img.size().height) * 0.5; 并将其输入ho

我使用的代码来自。它适用于我的大多数图像。但在所附的图像上它失败了-代码无法识别仪表的外部刻度盘/边界(在我的原始图像中,没有内部白色圆圈)


你知道会出什么问题吗?

这就是你想要的

如果是这样的话,这是一个调整一些参数的问题。特别是最小和最大圆半径以及圆距离(检测到的圆之间的最小距离)

要点

更新
如果要将最小半径与图像尺寸关联,可以执行以下操作:

float minRadius = MIN(img.size().width, img.size().height) * 0.5;
并将其输入houghCircles函数

我实际使用的参数(根据要点):


评论摘自。

为什么你认为这个问题与Linux有关?我并不是说这是Linux的问题。我只是想提供操作系统信息,感谢您提供了该功能的详细信息。我怎么说minRadius应该是最小值(图像宽度、图像高度)*0.5?如果您提供在以下调用中使用的值,这将非常有用:
HoughCircles(src_gray,circles,CV_HOUGH_GRADIENT,1,src_gray.rows/82000,100,0,0)我看了你最新的答案,这很有帮助。但我仍然没有得到你在图片中显示的红色圆圈。是否有可能分享您对不同参数使用的值-尤其是最小和最大圆半径以及允许您获得该圆的圆距离?@user2543622-应该与我在答案中输入的相同(最小半径250,最大半径300,minDist 60)-如果您无法重复该结果,我将重新检查我的代码。我调整了这些参数,并能够得到圆圈。谢谢
 HoughCircles(     img
                 , circles
                 , CV_HOUGH_GRADIENT //method – Detection method to use. 
                 // Currently,  the only implemented method is 
                 // CV_HOUGH_GRADIENT , which is  basically 21HT , 
                 // described in [Yuen90].
                 , 1 //p – Inverse ratio of the accumulator resolution to the 
                 // image resolution. For example, if dp=1 , the accumulator has 
                 // the same resolution as the input image. If dp=2 , 
                 // the accumulator has half as big width and height.
                 , 60  //minDist – Minimum distance between the centers of the 
                 // detected circles. If the parameter is too small, multiple 
                 // neighbor circles may be falsely detected in addition to a 
                 // true one. If it is too large, some circles may be missed.
                 , 100 //cannyThreshold – The higher threshold of the two 
                 // passed  to the gpu::Canny() edge detector 
                 // (the lower one is twice smaller).
                 , 30 //votesThreshold – The accumulator threshold for the circle 
                 // centers at the detection stage. The smaller it is, the more 
                 // false circles may be detected.
                 , 250 //minRadius – Minimum circle radius.
                 , 300 //maxRadius – Maximum circle radius.
                 );