How can unsharp masking avoid amplifying small fluctuations?
UnsharpMask boosts differences from a blurred image. Its threshold sets the minimum brightness change for sharpening.
Pixel experiment and interpretation
Place a point four levels above a flat field and compare thresholds. A high threshold can suppress noise and also miss genuine low-contrast detail.
from PIL import Image, ImageFilter
im=Image.new('L',(7,7),100)
im.putpixel((3,3),104)
[im.filter(ImageFilter.UnsharpMask(1,200,t)).getpixel((3,3)) for t in (0,20)]Result [110, 104]
中文
如何限制非锐化掩模对微弱波动的放大?
UnsharpMask 依据原图与模糊图的差增强细节,threshold 指定触发所需的亮度差。
像素实验与适用边界
在平面中央放一个只亮四级的点,比较两个阈值。较高阈值有助于抑制噪声,也可能略过真实低对比细节。
from PIL import Image, ImageFilter
im=Image.new('L',(7,7),100)
im.putpixel((3,3),104)
[im.filter(ImageFilter.UnsharpMask(1,200,t)).getpixel((3,3)) for t in (0,20)]结果 [110, 104]