Python_opencv(邊緣保留濾波EPF)
阿新 • • 發佈:2018-11-08
邊緣保留濾波(EPF)
import cv2 as cv import numpy as np def bi_demo(image): #高斯雙邊 ##dst=cv.bilateralFilter(image,0,100,15) dst=cv.bilateralFilter(src=image,d=0,sigmaColor=100,sigmaSpace=15) cv.imshow("bi_demo",dst) kennel=np.array([[0,-1,0],[-1,5,-1],[0,-1,0]],np.float32) #銳化操作,試圖向更立體 dst1=cv.filter2D(dst,-1,kennel) #-1表示和原圖一樣 cv.imshow("new",dst1) def shift_demo(image): #均值偏移 dst=cv.pyrMeanShiftFiltering(image,10,50) cv.imshow("shift_demo",dst) print('---Hello Python-----') src=cv.imread('E:/aaaxuexi/python_z/zhanglaoshi/lianxi/liuyifei.jpg') cv.imshow('xiaojiejie',src) bi_demo(src) shift_demo(src) cv.waitKey(0) cv.destroyAllWindows()
原圖:
均值遷移:
高斯雙邊: