使用 Pillow 库在图像上应用中值滤波器
在此程序中,我们将使用 pillow 库对图像应用最小值滤波器。在中值滤波中,图像中所选窗口中每个像素的值都将替换为该窗口的中值。filter 函数用于使用 pillow 库应用不同的滤波器。
原始图像

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

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