How do you expand dark defects into nearby pixels?
MinFilter propagates the neighborhood minimum to the center, expanding dark areas.
Pixel experiment and interpretation
Put one black defect on white. A three-by-three window spreads it into a ring of neighbors. Check polarity if defects are labeled white.
from PIL import Image, ImageFilter
im=Image.new('L',(5,5),255)
im.putpixel((2,2),0)
im.filter(ImageFilter.MinFilter(3)).histogram()[0]Result 9
中文
怎样把小块暗色缺陷扩展到邻近像素?
MinFilter 把窗口内最小值传播到中心,暗区域会向外扩张。
像素实验与适用边界
白底上点一个黑点,三乘三窗口会让周围一圈也变黑。若用白色标缺陷,传播方向就与想法相反。
from PIL import Image, ImageFilter
im=Image.new('L',(5,5),255)
im.putpixel((2,2),0)
im.filter(ImageFilter.MinFilter(3)).histogram()[0]结果 9