SMIL  0.8
 All Classes Functions Variables Groups Pages
operators.py

1 from smilPython import *
2 
3 # Load an image
4 im1 = Image("http://cmm.ensmp.fr/~faessel/smil/images/lena.png")
5 im1.show()
6 
7 im2 = Image(im1)
8 # Mask of im1>0:
9 # im1 > 100 returns an image = 255 when im1>100 and = 0 otherwise
10 # take the result and make the inf (&) with the original image
11 im2 << ( (im1>100) & im1 )
12 im2.show()
13 
14 
15 im3 = Image(im1)
16 sePts = ((0,0), (0,1), (1,1), (1,0), (-1,1), (-1,0), (-1,-1), (0,-1), (1,-1))
17 # Fill 0
18 im3 << 0
19 # Take the sup with each translation of im1...
20 for (dx,dy) in sePts:
21  im3 |= trans(im1, dx, dy)
22 im3.show()