模糊前
模糊后
模糊
import os
from PIL import Image, ImageFilter
facesPath = 'face' # 图片文件夹路径
faces = os.listdir(facesPath)
for face in faces:
facePath = os.path.join(facesPath, face)
image = Image.open(facePath)
blurred_image = image.filter(ImageFilter.BLUR)
blurred_image.save('blurryFace/'+face) # 模糊后的图片存储路径