天天看點

OpenCV python 高斯濾波與雙邊濾波

OpenCV python 高斯濾波與雙邊濾波

原圖檔[img_src.jpg]

OpenCV python 高斯濾波與雙邊濾波
import cv2
import numpy as np


def main():

    # 1.建立原圖檔
    img_src = np.zeros((500, 500), dtype=np.uint8)
    img_src[:, 250:] = 255

    # 2.執行雙邊濾波與高斯濾波
    img_dst = cv2.bilateralFilter(img_src, 55, 100, 100)
    img_gauss = cv2.GaussianBlur(img_src, (55, 55), 0, 0)

    # 3.顯示結果
    cv2.imshow("img_src", img_src)
    cv2.imshow("img_dst", img_dst)
    cv2.imshow("img_gauss", img_gauss)

    cv2.waitKey()
    cv2.destroyAllWindows()


if __name__ == '__main__':
    main()

           

雙邊濾波[img_dst.jpg]

OpenCV python 高斯濾波與雙邊濾波

高斯濾波[img_gauss.jpg]

OpenCV python 高斯濾波與雙邊濾波

繼續閱讀