滤镜 & scipy处理图片(含三种降噪:高斯滤波,中值滤波,维纳滤波)
滤镜
导包:
from PIL import Image, ImageFilter
读取图片
cat = Image.open('../data/cat.jpg')
cat
各种滤镜效果
- 全大写的才是滤镜
# blur 模糊, contour轮廓, detail 细节增加 edge_enhance边缘强化, emboss浮雕, find_edges找到边缘, sharpen锐化, Smooth柔化
cat.filter(ImageFilter.BLUR)
scipy处理图片
- 使用 scipy 中的小浣熊(misc)图片为例
- 使用ndimage移动坐标、旋转图片、切割图片、缩放图片
导包:
from scipy import misc
from scipy import ndimage
读取小浣熊的正脸照
face = misc.face()
face
展示图片
plt.figure(figsize=(10,8))
plt.imshow(face)
使用ndimage移动坐标、旋转图片、切割图片、缩放图片
移动坐标:ndimage.shift
# mode : {'reflect'反射, 'constant', 'nearest', 'mirror', 'wrap'}
face_shift = ndimage.shift(face, shift=(-200, -