Debian Codegraph @

examples/flow2rgb.py

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