SMIL  0.8
 All Classes Functions Variables Groups Pages
hit_or_miss.py

1 from smilPython import *
2 
3 # Load an image
4 im1 = Image("http://cmm.ensmp.fr/~faessel/smil/images/balls.png")
5 im1.show()
6 
7 # Create the skeleton using a thinning with a combination of the 4 rotations of the composite SE sL1 and sL2
8 im2 = Image(im1)
9 fullThin(im1, HMT_sL1(4) | HMT_sL2(4), im2)
10 
11 # Detect line junctions
12 im3 = Image(im1)
13 hitOrMiss(im2, HMT_sLineJunc(8), im3)
14 
15 # Detect line ends
16 im4 = Image(im1)
17 hitOrMiss(im2, HMT_sLineEnd(8), im4)
18 
19 # Modigy results for display...
20 dilate(im3, im3, hSE())
21 dilate(im4, im4, hSE())
22 inf(im3, 1, im3)
23 inf(im4, 3, im4)
24 sup(im3, im4, im4)
25 
26 im2.getViewer().drawOverlay(im4)
27 im2.show()
28