def get_edges(img_path):
'''
input: the image path
output: a numpy ndarray of the edges in this image
'''
img = cv2.imread(img_path)
RGB_img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
gray_image = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# kernel = np.ones((5,5),np.float32)/25
# dst = cv2.filter2D(img,-1,kernel)
edges = cv2.Canny(gray_image,100,200)
return edges
edge_detection.py 文件源码
python
阅读 24
收藏 0
点赞 0
评论 0
评论列表
文章目录