How to use the imgviz.depth2rgb function in imgviz

To help you get started, we’ve selected a few imgviz examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wkentaro / imgviz / tests / test_depth.py View on Github external
def test_depth2rgb():
    data = imgviz.data.arc2017()

    depthviz = imgviz.depth2rgb(data["depth"])

    assert depthviz.dtype == np.uint8
    H, W = data["depth"].shape[:2]
    assert depthviz.shape == (H, W, 3)
github wkentaro / imgviz / examples / io_examples / pyglet_imshow.py View on Github external
def get_images():
    data = imgviz.data.arc2017()
    yield data["rgb"]
    yield imgviz.depth2rgb(data["depth"], min_value=0.3, max_value=1)
    yield imgviz.label2rgb(data["class_label"])
github wkentaro / imgviz / examples / depth2rgb.py View on Github external
def depth2rgb():
    data = imgviz.data.arc2017()

    depthviz = imgviz.depth2rgb(data["depth"], min_value=0.3, max_value=1)

    # -------------------------------------------------------------------------

    plt.figure(dpi=200)

    plt.subplot(121)
    plt.title("rgb")
    plt.imshow(data["rgb"])
    plt.axis("off")

    plt.subplot(122)
    plt.title("depth (colorized)")
    plt.imshow(depthviz)
    plt.axis("off")

    img = imgviz.io.pyplot_to_numpy()
github wkentaro / imgviz / getting_started.py View on Github external
import matplotlib.pyplot as plt

here = osp.dirname(osp.abspath(__file__))  # NOQA

# -----------------------------------------------------------------------------
# GETTING_STARTED {{
import imgviz


# sample data of rgb, depth, class label and instance masks
data = imgviz.data.arc2017()

# colorize depth image with JET colormap
depth = data["depth"]
depthviz = imgviz.depth2rgb(depth, min_value=0.3, max_value=1)

# colorize label image
class_label = data["class_label"]
labelviz = imgviz.label2rgb(class_label, label_names=data["class_names"])

# instance bboxes
rgb = data["rgb"]
bboxes = data["bboxes"].astype(int)
labels = data["labels"]
captions = [data["class_names"][l] for l in labels]
bboxviz = imgviz.instances2rgb(image=rgb, bboxes=bboxes, labels=labels, captions=captions)

# instance masks
masks = data["masks"] == 1
maskviz = imgviz.instances2rgb(image=rgb, masks=masks, labels=labels, captions=captions)