Debian Codegraph @

README.md

raw symbols SCIP
1 <!-- DO NOT EDIT THIS FILE MANUALLY. This file is generated by generate_readme.py. -->
2
3 <h1 align="center">
4 imgviz
5 </h1>
6
7 <h4 align="center">
8 Image Visualization Tools
9 </h4>
10
11 <div align="center">
12 <a href="https://pypi.python.org/pypi/imgviz"><img src="https://img.shields.io/pypi/v/imgviz.svg"></a>
13 <a href="https://pypi.org/project/imgviz"><img src="https://img.shields.io/pypi/pyversions/imgviz.svg"></a>
14 <a href="https://github.com/wkentaro/imgviz/actions"><img src="https://github.com/wkentaro/imgviz/workflows/ci/badge.svg"></a>
15 </div>
16
17 <div align="center">
18 <a href="#installation"><b>Installation</b></a> |
19 <a href="#getting-started"><b>Getting Started</b></a> |
20 <a href="#examples"><b>Examples</b></a> |
21 <a href="https://github.com/wkentaro/imgviz-cpp"><b>C++ Version</b></a>
22 </div>
23
24 <br/>
25
26 <div align="center">
27 <img src="https://github.com/wkentaro/imgviz/raw/main/.readme/getting_started.jpg" width="95%">
28 </div>
29
30 ## Installation
31
32 ```bash
33 pip install imgviz
34
35 # there are optional dependencies like skimage, below installs all.
36 pip install imgviz[all]
37 ```
38
39
40 ## Dependencies
41
42 - [matplotlib](https://pypi.org/project/matplotlib)
43 - [numpy](https://pypi.org/project/numpy)
44 - [Pillow>=5.3.0](https://pypi.org/project/Pillow)
45 - [PyYAML](https://pypi.org/project/PyYAML)
46
47 ## Getting Started
48
49 ```python
50 # getting_started.py
51
52 import imgviz
53
54 # sample data of rgb, depth, class label and instance masks
55 data = imgviz.data.arc2017()
56
57 rgb = data["rgb"]
58 gray = imgviz.rgb2gray(rgb)
59
60 # colorize depth image with JET colormap
61 depth = data["depth"]
62 depthviz = imgviz.depth2rgb(depth, min_value=0.3, max_value=1)
63
64 # colorize label image
65 class_label = data["class_label"]
66 labelviz = imgviz.label2rgb(
67 class_label, image=gray, label_names=data["class_names"], font_size=20
68 )
69
70 # instance bboxes
71 bboxes = data["bboxes"].astype(int)
72 labels = data["labels"]
73 masks = data["masks"] == 1
74 captions = [data["class_names"][l] for l in labels]
75 maskviz = imgviz.instances2rgb(gray, masks=masks, labels=labels, captions=captions)
76
77 # tile instance masks
78 insviz = [
79 (rgb * m[:, :, None])[b[0] : b[2], b[1] : b[3]] for b, m in zip(bboxes, masks)
80 ]
81 insviz = imgviz.tile(imgs=insviz, border=(255, 255, 255))
82 insviz = imgviz.resize(insviz, height=rgb.shape[0])
83
84 # tile visualization
85 tiled = imgviz.tile(
86 [rgb, depthviz, labelviz, maskviz, insviz],
87 shape=(1, 5),
88 border=(255, 255, 255),
89 border_width=5,
90 )
91 ```
92
93 ## [Examples](examples)
94
95 <table>
96 <tr>
97 <td><pre><a href="examples/centerize.py">examples/centerize.py</a></pre></td>
98 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/centerize.jpg" width="53.333333333333336%" /></td>
99 </tr>
100 <tr>
101 <td><pre><a href="examples/depth2rgb.py">examples/depth2rgb.py</a></pre></td>
102 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/depth2rgb.jpg" width="78.16091954022988%" /></td>
103 </tr>
104 <tr>
105 <td><pre><a href="examples/draw.py">examples/draw.py</a></pre></td>
106 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/draw.jpg" width="37.79047619047619%" /></td>
107 </tr>
108 <tr>
109 <td><pre><a href="examples/flow2rgb.py">examples/flow2rgb.py</a></pre></td>
110 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/flow2rgb.jpg" width="52.21052631578947%" /></td>
111 </tr>
112 <tr>
113 <td><pre><a href="examples/instances2rgb.py">examples/instances2rgb.py</a></pre></td>
114 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/instances2rgb.jpg" width="66.35451505016722%" /></td>
115 </tr>
116 <tr>
117 <td><pre><a href="examples/label2rgb.py">examples/label2rgb.py</a></pre></td>
118 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/label2rgb.jpg" width="76.01532567049807%" /></td>
119 </tr>
120 <tr>
121 <td><pre><a href="examples/nchannel2rgb.py">examples/nchannel2rgb.py</a></pre></td>
122 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/nchannel2rgb.jpg" width="52.21052631578947%" /></td>
123 </tr>
124 <tr>
125 <td><pre><a href="examples/plot_trajectory.py">examples/plot_trajectory.py</a></pre></td>
126 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/plot_trajectory.jpg" width="26.86868686868687%" /></td>
127 </tr>
128 <tr>
129 <td><pre><a href="examples/resize.py">examples/resize.py</a></pre></td>
130 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/resize.jpg" width="47.238095238095234%" /></td>
131 </tr>
132 <tr>
133 <td><pre><a href="examples/tile.py">examples/tile.py</a></pre></td>
134 <td><img src="https://github.com/wkentaro/imgviz/raw/main/examples/.readme/tile.jpg" width="35.812274368231044%" /></td>
135 </tr>
136 </table>