PIL是Python Imaging Library,它為python解釋器提供了圖像編輯函數。 ImageFilter模塊包含一組預定義的過濾器的定義,這些定義可與
Image.filter()
方法。PIL.ImageFilter.MinFilter()
方法創建一個最小過濾器。在給定大小的窗口中選取最低像素值。
用法: PIL.ImageFilter.MinFilter(size=3) 參數: size: The kernel size, in pixels.
使用的圖片:
# Importing Image and ImageFilter module from PIL package
from PIL import Image, ImageFilter
# creating a image object
im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG")
# applying the min filter
im2 = im1.filter(ImageFilter.MinFilter(size = 3))
im2.show()
輸出:
PIL.ImageFilter.MinFilter()
方法創建一個最大過濾器。在給定大小的窗口中選取最大的像素值。
用法: PIL.ImageFilter.MaxFilter(size=3) 參數: size: The kernel size, in pixels.
# Importing Image and ImageFilter module from PIL package
from PIL import Image, ImageFilter
# creating a image object
im1 = Image.open(r"C:\Users\sadow984\Desktop\download2.JPG")
# applying the max filter
im2 = im1.filter(ImageFilter.MaxFilter(size = 3))
im2.show()
輸出:
相關用法
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python set()用法及代碼示例
- Python os.WEXITSTATUS()用法及代碼示例
- Python os._exit()用法及代碼示例
- Python PIL UnsahrpMask()用法及代碼示例
- Python os.abort()用法及代碼示例
- Python os.ftruncate()用法及代碼示例
- Python os.setgroups()用法及代碼示例
- Python os.WIFEXITED()用法及代碼示例
- Python PIL RankFilter()用法及代碼示例
- Python os.ftruncate()用法及代碼示例
- Python os.getcwd()用法及代碼示例
- Python os.sendfile()用法及代碼示例
注:本文由純淨天空篩選整理自ravikishor大神的英文原創作品 Python PIL | MinFilter() and MaxFilter() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。