SMIL 1.1.1
Loading...
Searching...
No Matches
first-program.py
1# import smilPython module
2import smilPython as sp
3
4# define which structuring element to use
5se = sp.SquSE()
6
7# get your first image
8# try replacing the URL by some image stored in your computer.
9imIn = sp.Image("https://smil.cmm.minesparis.psl.eu/images/lena.png")
10imIn.show("Lena original")
11
12# declare two images for results
13imA = sp.Image(imIn)
14imA.show("erode")
15
16imB = sp.Image(imIn)
17imB.show("dilate")
18
19# erosion and dilation
20r = sp.erode(imIn, imA, se())
21r = sp.dilate(imIn, imB, se())
22
23input("Hit enter to continue")
24
25# now let's do some filtering with a SE of size 2
26r = sp.open(imIn, imA, se(2))
27imA.setName("open")
28r = sp.close(imIn, imB, se(2))
29imB.setName("close")
30
31input("Hit enter to continue")