简体   繁体   English

使用 Python OpenCV 测量已知圆的精确 position

[英]Measure exact position of known circle using Python OpenCV

I have an image containing a bunch of circular features.我有一张包含一堆圆形特征的图像。 I'd like to know exactly the exact location of the centre of a particular circle and its radius (preferably with sub-pixel accuracy).我想确切地知道特定圆的中心的确切位置及其半径(最好具有亚像素精度)。

校准圈

Rather than using a circle detector, which will try to find all of the circles, is there a method in OpenCV for fitting a circle to the image? OpenCV 中是否有一种方法可以将圆形拟合到图像中,而不是使用圆形检测器来尝试找到所有圆形? Like this:像这样:

检测到校准圈


Update:更新:

I have tried using the Hough circle detection method, and it seems to get confused about whether the circle should be on the inside or outside edge of the black line.我尝试过使用霍夫圆检测方法,似乎对圆应该在黑线的内侧还是外侧边缘感到困惑。 The circle jumps around between the inside and outside edges, or sometimes tries to do both.圆圈在内外边缘之间跳跃,或者有时尝试两者都做。

霍夫圆检测问题

All I can think of now is, if you know the approximate centre and radius, search for all the circles and use least fitting squares with the circle equation to find the one you are looking for.我现在能想到的就是,如果你知道大概的中心和半径,搜索所有的圆,并使用圆方程的最小拟合平方来找到你要找的那个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM