[hofig7s1] [Up] [hofig7s4] Chapter 7 - Morphological Segmentation - Watershed

hofig7s2
Segmentation by watershed

Description

This figure illustrates the segmentation by watershed from markers.

Demo Script

.

from morph import *
from MLab import transpose
a = transpose(mmreadgray('beef.tif'));
c = mmthreshad(a,uint8(10));
d = mmareaclose(c,200);
e = mmgradm(d,mmsecross(1),mmsebox(9));
f = mmero(d,mmsecross(95));
g = mmunion(e,f);
h = mmgradm(mmclose(a));
ws= mmcwatershed(h,g);
fig_a=mmunion(mmgray(g),h);
fig_b=ws;
fig_c=mmintersec(mmgray(mmneg(mmdil(ws))),a);
mmshow(fig_a)
mmshow(fig_b)
mmshow(fig_c)
fig_a fig_b
fig_c

[hofig7s1] [Up] [hofig7s4] http://www.python.org