python低通滤波器图像模糊处理_防盗印图像处理测试程序

"""低通滤波器图像模糊处理_防盗印图像处理测试程序,由于pillow的高斯模糊无法满足要求,所以用opencv"""

import cv2,os 
import numpy as np
from matplotlib import pyplot as plt

path = 'C:\\Users\\Administrator\\Desktop\\images'
imagefile = path + os.sep + "001.jpg"  # I 不支持中文路径和png图

img = cv2.imread(imagefile)

dst = cv2.blur(img,(2,2))             # 低通滤波器糊模处理

# 以jpeg50质量保存为测试图
cv2.imwrite('c:/test.jpg',dst,[int(cv2.IMWRITE_JPEG_QUALITY),50])

'''
plt.subplot(121),plt.imshow(img,cmap='gray'),plt.title('Original')
plt.xticks([]),plt.yticks([])
plt.subplot(122),plt.imshow(dst,cmap='gray'),plt.title('Averaging')
plt.xticks([]),plt.yticks([])
plt.show()
'''

附pillow的Box模糊图片处理程序:

from PIL import Image, ImageFilter
import os


path = 'C:\\Users\\Administrator\\Desktop\\images'
imagefile = path + os.sep + "图001.png"

img = Image.open(imagefile).filter(ImageFilter.BoxBlur)
img.save("C:/test.png")