Measure real-world distance
1from lynx import LYNX2import numpy as np3 4model = LYNX("lynx-basic", camera="realsense-d435")5depth = np.load("depth.npy") # (H, W) float32 meters6results = model("frame.jpg", depth=depth)7 8for i in range(len(results)):9 print(f"{results.labels[i]} at {results.instance_depth[i]:.2f}m")A 2D bounding box tells you a person's shape in the frame. Adding depth tells you they're 1.5 meters away. For robotics, AR, safety, anything where the physical world matters, that distinction is the whole game — "pedestrian detected at 1m" needs an emergency response; "pedestrian detected at 30m" doesn't.
Use depth when:
- AR overlays that need to occlude / blend with the real scene
- Safety zones (collision warnings, speed-of-approach triggers)
- Robotic navigation (where the obstacle is, not just that it exists)
- Accurate measurement (height, distance between objects, room dimensions)
Two requirements: a model trained on RGBD inputs (its metadata must declare lynx_emits_instance_depth=true), and a depth map aligned with the RGB frame. Most camera SDKs (RealSense, ZED) give you both as time-synced numpy arrays.
The camera= preset sets the intrinsics so back-projection is correct. Available: realsense-d435, realsense-d455, zed-2i, zed-x. If you're on a different sensor, you can pass your own intrinsics dict, but the presets are tested.
results.instance_depth[i] is the per-detection median depth (robust to background pixels leaking into the box). results.dense_depth is the full (H, W) depth map if you want to do your own pooling — minimum-depth for collision warnings, mean for room-mapping, etc.