图像处理-图像锐化

1、Sobel锐化

2、Laplacian锐化

3、完整代码


def EdgeProcess(image):
    Result1_x = cv.Sobel(image,ddepth=-1,dx=1,dy=0)
    Result1_y = cv.Sobel(image,ddepth=-1,dx=0,dy=1)

    #x方向一阶边缘
    SobelResult_x = cv.convertScaleAbs(Result1_x)
    #y方向一阶边缘
    SobelResult_y = cv.convertScaleAbs(Result1_y)
    #整幅图像一阶边缘
    SobelResult_xy = SobelResult_x+SobelResult_y

    SobelResult_Result = cv.hconcat((SobelResult_x,SobelResult_y,SobelResult_xy))
    cv.imshow("SobelResult",SobelResult_Result)
    cv.waitKey()

    #拉普拉斯算子
    Result2 = cv.Laplacian(image,ddepth=-1,ksize=3)
    LaplacianResult = cv.convertScaleAbs(Result2)
    cv.imshow("Laplacian",LaplacianResult)
    cv.waitKey()


    return;

猜你喜欢

转载自blog.csdn.net/xdg15294969271/article/details/121260657