SMIL  0.8
 All Classes Functions Variables Groups Pages
extinction_values.py

1 from smilPython import *
2 
3 imIn = Image("http://cmm.ensmp.fr/~faessel/smil/images/lena.png")
4 imGrad = Image(imIn)
5 imMark = Image(imIn, "UINT16")
6 imBasins = Image(imMark)
7 
8 gradient(imIn, imGrad)
9 hMinimaLabeled(imGrad, 5, imMark)
10 
11 nRegions = 25
12 extType = "v"
13 
14 # Graph version
15 
16 imGraphOut = Image(imMark)
17 g = watershedExtinctionGraph(imGrad, imMark, imBasins, extType)
18 g.removeLowEdges(nRegions)
19 graphToMosaic(imBasins, g, imGraphOut)
20 # Re-labelize (usefull only to have the same label values in both versions)
21 label(imGraphOut, imGraphOut)
22 imGraphOut.showLabel()
23 
24 
25 # Image version
26 
27 imImgOut = Image(imMark)
28 watershedExtinction(imGrad, imMark, imImgOut, imBasins, extType)
29 compare(imImgOut, ">", nRegions, 0, imMark, imMark);
30 basins(imGrad, imMark, imImgOut)
31 # Re-labelize (usefull only to have the same label values in both versions)
32 label(imImgOut, imImgOut)
33 imImgOut.showLabel()