下面是代码:
self.img = cv2.imread(image,)
circle = cv2.HoughCircles(self.img, 3,
dp=1.5, minDist=1000, minRadius=100, maxRadius=1000)
red = (0,0,255)
x = circle[0][0][0]
y = circle[0][0][1]
r = circle[0][0][2]
cv2.circle(self.img, (x, y), r, red, 2)
x - X
y - Y
r - Radius
For example: 521.25, 506.25, 318.919
从代码中如何裁剪给定示例中的圆?
很简单。。你需要得到矩形右上角的x,y坐标,然后找到和高度。圆只能用正方形包围。
后圆=cv2.houghcirles(img,…)
相关问题 更多 >
编程相关推荐