Skip to main content
Estimate depth from stereo pair using FoundationStereo.
Input images up to 1280 x 720 (width x height). Larger images are rejected with HTTP 413, not downscaled — resize first.

Parameters

Union[str, Image.Image, np.ndarray]
Left stereo image.
Union[str, Image.Image, np.ndarray]
Right stereo image.
ImageInput | None
Rectified [left | right] frame, with equal-width views and at most 720x1280 pixels per eye. Supply this instead of left_image and right_image.
bool
default:"False"
If true, return a dictionary containing “depth” (float32 HxW) and “left_image” (uint8 RGB HxWx3). The left image can be passed to any segmentation model.
Dict[str, Any]
Camera parameters: - “K”: 3x3 intrinsics for the rectified left view at input resolution - “baseline”: Stereo baseline in meters - “hiera”: Hierarchy level (0-2) - “valid_iters”: Number of valid iterations
float | None
Optional HTTP timeout.

Returns

np.ndarray | dict[str, np.ndarray]: Depends on return_left_image:
  • False (default): The depth array.
  • True: A dictionary with “depth” and “left_image” arrays.
Depth is float32 with shape (H, W), in meters. The optional left image is uint8 RGB with shape (H, W, 3), aligned with depth. Both use the input per-eye resolution; the server performs no resizing or rectification.

Example