[hofig3s23] [Up] [hofig3s25] Chapter 3 - Morphological Processing of Binary Images

hofig3s24
Connected operators

Description

This figure illustrates the partitions of a binary image and the application of a connected operator.

Demo Script

.

from morph import *
from MLab import rot90
f=mmreadgray('pcbholes.tif')
f=rot90(rot90(f))
f=f[:,:-10]
fr1=mmlabel(f)
fr2=mmlabelflat(f)
print mmstats(fr1,'max')
7.0
print mmstats(fr2,'max')
12.0
a=mmopen(f,mmsedisk(10))
b=mmopenrec(f,mmsedisk(10))
fr3=mmlabelflat(b)
print mmstats(fr3,'max')
9.0
mmshow(f)
mmlblshow(fr1,'BORDER')
mmlblshow(fr2,'BORDER')
fig_d = mmunion(mmgradm(f,mmsecross(0)),a)
fig_e = mmunion(mmgradm(f,mmsecross(0)),b)
mmshow(fig_d)
mmshow(fig_e)
mmlblshow(fr3,'BORDER')
f fr1,'BORDER'
fr2,'BORDER' fig_d
fig_e fr3,'BORDER'

[hofig3s23] [Up] [hofig3s25] http://www.python.org