esc
Start typing to search the docs
Navigate Open

EncodedDepthImage

⚠️ This type is unstable and may change significantly in a way that the data won't be backwards compatible. A depth image encoded with a codec (e.g. RVL or PNG).

Rerun also supports uncompressed depth images with the archetypes.DepthImage.

Fields

Required

Optional

Can be shown in

Example

Encoded depth image

"""Log an encoded depth image stored as a 16-bit PNG or RVL file."""

import sys
from pathlib import Path

import rerun as rr

if len(sys.argv) < 2:
    print(f"Usage: {sys.argv[0]} <path_to_depth_image.[png|rvl]>", file=sys.stderr)
    sys.exit(1)

depth_path = Path(sys.argv[1])

rr.init("rerun_example_encoded_depth_image", spawn=True)

depth_png = depth_path.read_bytes()
if depth_path.suffix.lower() == ".png":
    media_type = rr.components.MediaType.PNG
else:
    media_type = rr.components.MediaType.RVL

rr.log(
    "depth/encoded",
    rr.EncodedDepthImage(
        blob=depth_png,
        media_type=media_type,
        meter=0.001,
    ),
)