我的图片在这里:
我正在寻找更好的解决方案或算法来检测这张照片中的椭圆形部分(盘),并在Opencv中的另一张照片中对其进行遮罩.
你能给我一些建议或解决方案吗?
我的代码是:
circles = cv2.HoughCircles(img, cv2.HOUGH_GRADIENT, 1.2, 1, param1=128, minRadius=200, maxRadius=600)
# draw detected circles on image
circles = circles.tolist()
for cir in circles:
for x, y, r in cir:
x, y, r = int(x), int(y), int(r)
cv2.circle(img, (x, y), r, (0, 255, 0), 4)
# show the output image
cv2.imshow("output", cv2.resize(img, (500, 500)))
解决方法:
Xie,Yonghong和Qiang Ji制作的skimage中有另一种替代方法,并出版为…
“A new efficient ellipse detection method.” Pattern Recognition, 2002.
Proceedings. 16th International Conference on. Vol. 2. IEEE, 2002.
他们的椭圆检测代码相对较慢,此示例大约需要70秒;相比网站声称“ 28秒”.
如果您有conda或pip:“名称”,请安装scikit-image并试一试…
可以找到here或下面的副本/粘