How to use the imgviz.io.pyplot_to_numpy 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 / io_tests / test_pyplot.py View on Github external
def test_pyplot():
    backend = plt.get_backend()
    plt.switch_backend("agg")

    x = y = [0, 1, 2]
    plt.plot(x, y)

    plt.switch_backend(backend)

    img = imgviz.io.pyplot_to_numpy()
    assert isinstance(img, np.ndarray)
    assert img.ndim == 3
github wkentaro / imgviz / examples / label2rgb.py View on Github external
plt.subplot(131)
    plt.title("+img")
    plt.imshow(labelviz_withimg)
    plt.axis("off")

    plt.subplot(132)
    plt.title("loc=centroid")
    plt.imshow(labelviz_withname1)
    plt.axis("off")

    plt.subplot(133)
    plt.title("loc=rb")
    plt.imshow(labelviz_withname2)
    plt.axis("off")

    img = imgviz.io.pyplot_to_numpy()
    plt.close()

    return img
github wkentaro / imgviz / examples / resize.py View on Github external
# -------------------------------------------------------------------------

    plt.figure(dpi=200)

    plt.subplot(121)
    plt.title("rgb:\n{}".format(rgb.shape))
    plt.imshow(rgb)
    plt.axis("off")

    plt.subplot(122)
    plt.title("rgb_resized:\n{}".format(rgb_resized.shape))
    plt.imshow(rgb_resized)
    plt.axis("off")

    img = imgviz.io.pyplot_to_numpy()
    plt.close()

    return img
github wkentaro / imgviz / examples / depth2rgb.py View on Github external
# -------------------------------------------------------------------------

    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()
    plt.close()

    return img
github wkentaro / imgviz / examples / flow2rgb.py View on Github external
# -------------------------------------------------------------------------

    plt.figure(dpi=200)

    plt.subplot(121)
    plt.title("image")
    plt.imshow(rgb)
    plt.axis("off")

    plt.subplot(122)
    plt.title("flow")
    plt.imshow(flowviz)
    plt.axis("off")

    img = imgviz.io.pyplot_to_numpy()
    plt.close()

    return img
github wkentaro / imgviz / examples / centerize.py View on Github external
plt.subplot(131)
    plt.title("original")
    plt.axis("off")
    plt.imshow(rgb)

    plt.subplot(132)
    plt.title("centerized1:\n{}".format(centerized1.shape))
    plt.imshow(centerized1)
    plt.axis("off")

    plt.subplot(133)
    plt.title("centerized2:\n{}".format(centerized2.shape))
    plt.imshow(centerized2)
    plt.axis("off")

    return imgviz.io.pyplot_to_numpy()
github wkentaro / imgviz / examples / nchannel2rgb.py View on Github external
# -------------------------------------------------------------------------

    plt.figure(dpi=200)

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

    plt.subplot(122)
    plt.title("res4 (colorized)")
    plt.imshow(nchannel_viz)
    plt.axis("off")

    img = imgviz.io.pyplot_to_numpy()
    plt.close()

    return img
github wkentaro / imgviz / examples / tile.py View on Github external
# -------------------------------------------------------------------------

    plt.figure(dpi=200)

    plt.subplot(121)
    plt.title("original")
    plt.imshow(rgb)
    plt.axis("off")

    plt.subplot(122)
    plt.title("instances")
    plt.imshow(tiled)
    plt.axis("off")

    img = imgviz.io.pyplot_to_numpy()
    plt.close()

    return img