imgviz
Image Visualization Tools
Installation
pip install imgviz
pip install imgviz[all]
Dependencies
Getting Started
import imgviz
data = imgviz.data.arc2017()
rgb = data["rgb"]
gray = imgviz.rgb2gray(rgb)
depth = data["depth"]
depthviz = imgviz.depth2rgb(depth, min_value=0.3, max_value=1)
class_label = data["class_label"]
labelviz = imgviz.label2rgb(
class_label, image=gray, label_names=data["class_names"], font_size=20
)
bboxes = data["bboxes"].astype(int)
labels = data["labels"]
masks = data["masks"] == 1
captions = [data["class_names"][l] for l in labels]
maskviz = imgviz.instances2rgb(gray, masks=masks, labels=labels, captions=captions)
insviz = [
(rgb * m[:, :, None])[b[0] : b[2], b[1] : b[3]] for b, m in zip(bboxes, masks)
]
insviz = imgviz.tile(imgs=insviz, border=(255, 255, 255))
insviz = imgviz.resize(insviz, height=rgb.shape[0])
tiled = imgviz.tile(
[rgb, depthviz, labelviz, maskviz, insviz],
shape=(1, 5),
border=(255, 255, 255),
border_width=5,
)