import numpy as np
import cv2
img = cv2.imread('demo.jpg')
print(img.shape, img.dtype)
cv2.imshow('input', img)
print("press anykey on the image")
cv2.waitKey(0)
height = img.shape[0]
width = img.shape[1]
dst = np.zeros((height, width, 3), np.uint8)
kernel = np.ones((5,5),np.float32)/25
print("filtering...", end='')
dst = cv2.filter2D(img,-1,kernel)
print("done.")
cv2.imshow('result', dst)
print("press anykey on the image")
cv2.waitKey(0)
cv2.destroyAllWindows()
----------
http://docs.opencv.org/3.1.0/d4/d13/tutorial_py_filtering.html
blur = cv2.blur(img,(5,5))
blur = cv2.boxFilter(img, (5,5))
blur = cv2.GaussianBlur(img,(5,5),0)
median = cv2.medianBlur(img,5)
blur = cv2.bilateralFilter(img,9,75,75)
댓글 없음:
댓글 쓰기