使用 Pillow 库对图像应用模式滤镜
我们在这个程序中将使用 Pillow 库对图像应用最小值滤镜。在模式滤镜中,图像选定区域中的每个像素值都将被此区域的众数替代。filter 函数用于使用 Pillow 库应用不同的滤镜。
原始图像

算法
Step 1: Import Image from Pillow. Step 2: Open the image. Step 3: Call the filter function and specify modefilter. Step 4: Display the output.
示例代码
from PIL import Image, ImageFilter
im = Image.open('testimage.jpg')
im1 = im.filter(ImageFilter.ModeFilter(size = 7))
im1.show()输出

广告
数据结构
网络
关系数据库管理系统
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP