Generalities
Most Smil features are available under Python, thanks to Swig as a module names smilPython.
Your first program
Type the following lines in your prefered text editor (copy and paste works fine) and name it, e.g., first-smil.py
.
9imIn = sp.Image(
"https://smil.cmm.minesparis.psl.eu/images/lena.png")
10imIn.show(
"Lena original")
20r = sp.erode(imIn, imA, se())
21r = sp.dilate(imIn, imB, se())
23input(
"Hit enter to continue")
26r = sp.open(imIn, imA, se(2))
28r = sp.close(imIn, imB, se(2))
31input(
"Hit enter to continue")
Run it and try to modify it.
- Note
- near all Smil functions return a value which means :
- 1 - if the function executed with no error
- 0 or any other value - an error occured. Usually there will be some message to explain the error.
- it's a good practice to verify the returned value and stop processing on errors and handle it.
Some rules