[hofig2s8] [Up] [hofig2s10] Chapter 2 - Binary Opening and Closing

hofig2s9
Filtering pepper noise

Description

This figure illustrates the use of closing for restoration of pepper noise.

Demo Script

.

from morph import *
from handson import *
from Numeric import shape
f=mmreadgray('text1.tif')
n=mmbggmodel(shape(f),mmsecross(),1,0.003)
n=mmdil(n,mmsecross())
f_cor=mmintersec(f,mmneg(n))
B=mmbinary([[1, 1],
            [1, 1]])
g=mmclose(f_cor,B)
mmshow(f)
mmshow(f_cor)
mmshow(g)
f f_cor g

[hofig2s8] [Up] [hofig2s10] http://www.python.org