标签:style lte 梯度 auto oat 基础 open def show
import cv2
import numpy as np
def blur_demo(image):
dst = cv2.blur(image,(5,5)) #5*5 blur[均值模糊]
cv2.imshow(‘blur demo‘,dst)
def median_blur_demo(image):
dst = cv2.medianBlur(image, 5) #中值模糊
cv2.imshow(‘median blur demo‘, dst)
def custom_blur_demo(image):
#kernel = np.ones([5,5],np.float32)/25 #自定义模糊
kernel = np.array([[0, -1, 0], [-1, 5, -1], [0, -1, 0]], np.float32)#达到锐化效果。一般矩阵值为奇数,或者矩阵总和=0 表示边缘梯度,矩阵总和=1:锐化
dst = cv2.filter2D(image,-1,kernel=kernel)
cv2.imshow(‘custom blur‘, dst)
src = cv2.imread("woman.jpg")
cv2.namedWindow("input image",cv2.WINDOW_AUTOSIZE)
cv2.imshow(‘input image‘,src)
custom_blur_demo(src)
cv2.waitKey(0)
cv2.destroyAllWindows()
标签:style lte 梯度 auto oat 基础 open def show
原文地址:https://www.cnblogs.com/August2019/p/12554212.html