Debian Codegraph @

examples/resize.py

raw symbols SCIP
1 #!/usr/bin/env python
2
3 import matplotlib.pyplot as plt
4
5 import imgviz
6
7
8 def resize():
9 data = imgviz.data.arc2017()
10
11 rgb = data["rgb"]
12
13 H, W = rgb.shape[:2]
14 rgb_resized = imgviz.resize(rgb, height=0.1)
15
16 # -------------------------------------------------------------------------
17
18 plt.figure(dpi=200)
19
20 plt.subplot(121)
21 plt.title("rgb:\n{}".format(rgb.shape))
22 plt.imshow(rgb)
23 plt.axis("off")
24
25 plt.subplot(122)
26 plt.title("rgb_resized:\n{}".format(rgb_resized.shape))
27 plt.imshow(rgb_resized)
28 plt.axis("off")
29
30 img = imgviz.io.pyplot_to_numpy()
31 plt.close()
32
33 return img
34
35
36 if __name__ == "__main__":
37 from base import run_example
38
39 run_example(resize)