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或下面的副本/粘贴其代码:
import matplotlib.pyplot as plt
from skimage import data, color, img_as_ubyte
from skimage.feature import canny
from skimage.transform import hough_ellipse
from skimage.draw import ellipse_perimeter
# Load picture, convert to grayscale and detect edges
image_rgb = data.coffee()[0:220, 160:420]
image_gray = color.rgb2gray(image_rgb)
edges = canny(image_gray, sigma=2.0,
low_threshold=0.55, high_threshold=0.8)
# Perform a Hough Transform
# The accuracy corresponds to the bin size