def canny(img, lowThreshold):
"""
Performs canny edge detection on the provided grayscale image.
:param img: a grayscale image
:param lowThreshold: threshold for the canny operation
:return: binary image containing the edges found by canny
"""
dst = np.zeros(img.shape, dtype=img.dtype)
cv2.blur(img, (3, 3), dst)
# canny recommends that the high threshold be 3 times the low threshold
# the kernel size is 3 as defined above
return cv2.Canny(dst, lowThreshold, lowThreshold * 3, dst, 3)
评论列表
文章目录