SMIL  1.0.3
hit_or_miss.py
1 from smilPython import *
2 
3 # Load an image
4 im1 = Image("https://smil.cmm.minesparis.psl.eu/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 
RES_T sup(const Image< T > &imIn1, const Image< T > &imIn2, Image< T > &imOut)
sup() - Sup of two images
Definition: DImageArith.hpp:254
RES_T inf(const Image< T > &imIn1, const Image< T > &imIn2, Image< T > &imOut)
inf() - Inf of two images
Definition: DImageArith.hpp:305
RES_T drawOverlay(const Image< T > &imToDraw, Image< T > &imOut)
Draw overlay.
Definition: DImage.hpp:516
RES_T fullThin(const Image< T > &imIn, const CompStrEltList &mhtSE, Image< T > &imOut)
fullThin() - Thinning transform (full)
Definition: DHitOrMiss.hpp:303
RES_T hitOrMiss(const Image< T > &imIn, const StrElt &foreSE, const StrElt &backSE, Image< T > &imOut, T borderVal=ImDtTypes< T >::min())
hitOrMiss() - Hit Or Miss transform
Definition: DHitOrMiss.hpp:70
RES_T dilate(const Image< T > &imIn, Image< T > &imOut, const StrElt &se=DEFAULT_SE, const T borderVal=ImDtTypes< T >::min())
dilate() - Morphological grayscale dilation
Definition: DMorphoBase.hpp:65