【发布时间】:2021-09-12 07:06:15
【问题描述】:
有没有办法检测这些图像上的半圆?
尝试了很多方法,结果都不好
例子:
image = cv2.imread('path_here', 0)
output = image.copy()
ret, thresh = cv2.threshold(image, 0, 255, cv2.THRESH_OTSU)
circles = cv2.HoughCircles(thresh, cv2.HOUGH_GRADIENT, 1, 110,
param1=25, param2=5, minRadius=9, maxRadius=10)
detected_circles = np.uint16(np.around(circles))
for (x, y, r) in detected_circles[0, :]:
cv2.circle(output, (x, y), r, (0, 0, 0), 2)
cv2.circle(output, (x, y), 2, (0, 255, 255), 2)
cv2.imshow('output', output)
cv2.waitKey(0)
cv2.destroyAllWindows()
【问题讨论】:
-
那张图片中哪里有一个半圆?
-
@Micka。图片更新
-
你只有正方形、直线和半圆吗?如果是这样,可能会更容易检测出正方形和线条,剩下的形状将是半圆形。
标签: python python-3.x opencv computer-vision