Mum*_*wiz 15 image pixel python-imaging-library python-3.x
我一直试图使用PIL模糊图像.
据我所知,我需要复制图像,然后从原始图片中将每个像素更改为周围像素的平均值.所以我没有走得太远,我正在使用python 3.3x
from PIL import Image
img = Image.open("source")
im = Image.copy(img)
Run Code Online (Sandbox Code Playgroud)
我知道如何使用putpixe,并获取像素的数据,但我无法弄清楚如何获得周围像素的平均值.
在此先感谢您的帮助!
tom*_*m10 24
你可以这样做:
blurred_image = original_image.filter(ImageFilter.BLUR)
Run Code Online (Sandbox Code Playgroud)
有关更多选项,请参阅ImageFilter模块.
你是正确的,因为你描述的过程会模糊图像,并且有些过滤器基本上直接按照你的建议行事(*例如",使用ImageFilter.Kernel内核具有恒定权重的方法).ImageFilter虽然使用会更快更容易,并且为您提供更多模糊和超越的选择.
| 归档时间: |
|
| 查看次数: |
26116 次 |
| 最近记录: |