PIL是Python Imaging Library,它為python解釋器提供了圖像編輯函數。 ImageFilter模塊包含一組預定義的過濾器的定義,這些定義可與
Image.filter()
方法。PIL.ImageFilter.UnsharpMask()
方法將Unsahrp蒙版濾鏡應用於輸入圖像。
用法: PIl.ImageFilter.UnsharpMask(radius=2, percent=150, threshold=3)
參數:
radius:模糊半徑
percent:銳化強度,以百分比為單位
threshold:閾值控製將被銳化的最小亮度變化
有關參數的說明,請參見此數字模糊銳化屏蔽
使用的圖片:
# 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 unsharpmask method
im2 = im1.filter(ImageFilter.UnsharpMask(radius = 3, percent = 200, threshold = 5))
im2.show()
輸出:
# 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 unsharpmask method
im2 = im1.filter(ImageFilter.UnsharpMask(radius = 4, percent = 500, threshold = 8))
im2.show()
輸出:
# 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 unsharpmask method
im2 = im1.filter(ImageFilter.UnsharpMask(radius = 5, percent = 500, threshold = 10))
im2.show()
輸出:
相關用法
- Python set()用法及代碼示例
- Python next()用法及代碼示例
- Python os.dup()用法及代碼示例
- Python PIL eval()用法及代碼示例
- Python sys.getrecursionlimit()用法及代碼示例
- Python sympy.rf()用法及代碼示例
- Python PIL getpalette()用法及代碼示例
- Python os.WIFEXITED()用法及代碼示例
- Python sympy.ff()用法及代碼示例
- Python os.sync()用法及代碼示例
- Python sympy.nT()用法及代碼示例
- Python Decimal max()用法及代碼示例
- Python os.fdatasync()用法及代碼示例
- Python Decimal min()用法及代碼示例
注:本文由純淨天空篩選整理自ravikishor大神的英文原創作品 Python PIL | UnsahrpMask() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。