EdgeDetection.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:dataArtist 作者: radjkarl 项目源码 文件源码
def _filter(img, method, k):
        if method == 'Edge gradient':
            sy = cv2.Sobel(img, ddepth=cv2.CV_64F, dx=0, dy=1, ksize=k)
            sx = cv2.Sobel(img, ddepth=cv2.CV_64F,dx=1, dy=0, ksize=k)
#             sx = sobel(img, axis=0, mode='constant')
#             sy = sobel(img, axis=1, mode='constant')
            return np.hypot(sx, sy)
        if method == 'Sobel-H':
            return cv2.Sobel(img, ddepth=cv2.CV_64F,dx=0, dy=1, ksize=k)
        #sobel(img, axis=0, mode='constant')
        if method == 'Sobel-V':
            return cv2.Sobel(img, ddepth=cv2.CV_64F,dx=1, dy=0, ksize=k)
        #sobel(img, axis=1, mode='constant')
        if method == 'Laplace':
            return cv2.Laplacian(img, ddepth=cv2.CV_64F,ksize=5)
        #laplace(img)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号