SMIL 1.1.2
Loading...
Searching...
No Matches
numpy_sp2np.py
1
2import smilPython as sm
3import numpy as np
4
5# read a PNG image file (8 bits gray image)
6file = "my-image.png")
7img = sm.Image(file)
8
9# show the image
10img.show(file)
11
12# get a NumPy array
13p = img.getNumpyArray()
14
15# let's threshold the image
16t = 127
17p[p >= t] = 255
18p[p < t] = 0
19
20# Call the "modified" method in order to update the viewer content
21img.modified()
22