[hofig3s22] [Up] [hofig3s24] Chapter 3 - Morphological Processing of Binary Images

hofig3s23
Logical structural opening

Description

This figure illustrates the application of the logical structural opening.

Demo Script

.

from morph import *
from Numeric import ones
A=mmreadgray('text2.tif')
B11=mmsedil(mmsebox(),mmserot(mmsedisk(13,'1D'),90)) # vertical
C=mmopenrec(A,B11,mmsebox())
Cneg=mmopenrecth(A,B11,mmsebox())
B12=mmsedil(mmsebox(),mmsedisk(8,'1D'))              # horizontal
D=mmopenrec(A,B12,mmsebox())
E=mmintersec(C,D)
B21=mmsedil(mmbinary(ones(2)),mmserot(mmsedisk(9,'1D'),45))
F=mmopenrec(A,B21,mmsebox())
B22=mmsedil(mmbinary(ones(2)),mmserot(mmsedisk(9,'1D'),-45))
G=mmopenrec(A,B22,mmsebox())
H=mmintersec(F,G,Cneg)  # diagonal but vertical
I=mmintersec(G,D)       # horizontal and diagonal
J=mmunion(H,I)
fig_a=A
fig_b=D
fig_c=F
fig_d=G
fig_e=Cneg
fig_f=H
fig_g=I
fig_h=J
mmshow(fig_a)
mmshow(fig_b)
mmshow(fig_c)
mmshow(fig_d)
mmshow(fig_e)
mmshow(fig_f)
mmshow(fig_g)
mmshow(fig_h)
fig_a fig_b
fig_c fig_d
fig_e fig_f
fig_g fig_h

[hofig3s22] [Up] [hofig3s24] http://www.python.org