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