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。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。