Skip to content

Attaching a depth image to a pinhole camera has unintuitive requirements on their entity paths #2479

@abey79

Description

@abey79

Describe the annoyance

Consider this code:

import numpy as np
import rerun as rr

# Create a depth image with Pillow
image = 65535 * np.ones((200, 300), dtype=np.uint16)
image[50:150, 50:150] = 20000
image[130:180, 100:280] = 45000

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

# We need a camera to register the depth image to
focal_length = 200
rr.log_pinhole(
    "camera",
    child_from_parent=np.array(
        (
            (focal_length, 0, image.shape[1] / 2),
            (0, focal_length, image.shape[0] / 2),
            (0, 0, 1),
        ),
    ),
    width=image.shape[1],
    height=image.shape[0],
)

# Log the tensor, assigning names to each dimension
rr.log_depth_image("camera/depth", image, meter=10000.0)

It looks like it should work but it doesn't. Fixing it requires adding a common root node in the pinhole and depth image's entity paths:

  • pinhole: "camera" -> "world/camera"
  • depth image: "camera/depth" -> "world/camera/depth"

This requirement is unintuitive, error prone, and probably under-documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    😤 annoyingSomething in the UI / SDK is annoying to use

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions