This figure illustrates the use of opening for restoration of pepper noise.
.
from morph import *
from handson import *
from Numeric import shape
f=mmbinary(ones((200,100)))
f=mmpad(f,mmsebox(25))
n=mmbggmodel(shape(f),mmsedisk(2),3,0.001)
fbin=mmunion(f,n)
B=mmsedisk(7)
g = mmopen(fbin,B)
mmshow(fbin)
mmshow(mmseshow(B))
mmshow(g)