def cav_edge(img, sigma):
"""
Detect edges in the recovered image.
Reference
=========
[1] Edge detection with canny by python
http://blog.csdn.net/matrix_space/article/details/49786427
Inputs
======
img: np.ndarray
the recovered image
sigma: float
the sigma in canny methods
Output
======
img_edge: np.ndarray
teh edge detected image
"""
# Reprocess of the image
# idx = np.where(img >= 1)
img_re = img
# img_re[idx] = 1
# Edge detect
edge = feature.canny(img_re, sigma=sigma)
# bool to integer
img_edge = edge.astype('int32')
return img_edge
评论列表
文章目录