def circles_per_radius(hough_radii, hough_res, number_circles_per_radius=16):
"""
Rates found circles by intensity of peaks inside the Hough matrix.
Chooses the best circles for each radius
Returns: Selected circle centers with their quality and radius
"""
centers = []
accums = []
radii = []
# for each radius and hough peak image
# zip([32,33,34,35,36],[(32, hough_peaks_img),(33, hough_peaks_img),(34, hough_peaks_img), ... ])
for radius, h in zip(hough_radii, hough_res): # iterieren durch circles (h)
# sort peaks, which represent the quality of circles by intensity
peaks = peak_local_max(h, num_peaks=number_circles_per_radius)
centers.extend(peaks)
accums.extend(h[peaks[:, 0], peaks[:, 1]])
# iterate through every (y,x) in peaks and get corresponding color value from h, which represents quality value of circle (?)
# so acuums represents quality
radii.extend([radius] * number_circles_per_radius)
#
return (centers, accums, radii)
cv.py 文件源码
python
阅读 19
收藏 0
点赞 0
评论 0
评论列表
文章目录