This figure illustrates the effects of opening and closing.
.
from morph import *
S=mmreadgray('g.tif')
E =mmbinary([[0, 0, 0], [0, 1, 1], [0, 1, 1]])
T=mmopen(S,E)
U=mmclose(S,E)
frame=mmunion(S,1)
Warning: Converting input image from int32 to binary uint8.
mmshow(mmbshow(frame,S))
mmshow(mmseshow(E,'EXPAND'))
mmshow(mmbshow(frame,T))
mmshow(mmbshow(frame,U))