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

hofig2s11
Open-close and close-open filters

Description

This figure illustrates the use of the open-close and close-open filters.

Demo Script

.

from morph import *
from handson import *
from Numeric import shape, ones
f=mmbinary(ones((200,100)))
f=mmpad(f,mmsebox(25))
n_salt=mmbggmodel(shape(f),mmsedisk(2),4,0.001)
n_pepper=mmbggmodel(shape(f),mmsedisk(2),4,0.001)
fbin=mmintersec(mmunion(f,n_salt),mmneg(n_pepper))
B=mmsedisk(7)
go  = mmopen(fbin,B)
goc = mmclose(go,B)
gc  = mmclose(fbin,B)
gco = mmopen(gc,B)
mmshow(fbin)
mmshow(go)
mmshow(goc)
mmshow(gc)
mmshow(gco)
fbin go goc gc
gco

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