> ## Documentation Index
> Fetch the complete documentation index at: https://docs.generalrobotics.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# foundationstereo

> Estimate depth from stereo pair using FoundationStereo

Estimate depth from stereo pair using FoundationStereo.

## Parameters

<ParamField body="left_image" type="Union[str, Image.Image, np.ndarray]" required>
  Left stereo image.
</ParamField>

<ParamField body="right_image" type="Union[str, Image.Image, np.ndarray]" required>
  Right stereo image.
</ParamField>

<ParamField body="aux_args" type="Dict[str, Any]">
  Camera parameters: - "K": 3x3 camera intrinsics matrix - "baseline": Stereo baseline in meters - "hiera": Hierarchy level (0-2) - "valid\_iters": Number of valid iterations
</ParamField>

<ParamField body="timeout" type="float | None">
  Optional HTTP timeout.
</ParamField>

## Returns

np.ndarray: Depth map as numpy array (H, W) with dtype float32.
Values represent metric depth in meters.

## Example

```python theme={null}
from grid_cortex_client import CortexClient, ModelType
import numpy as np
from PIL import Image
client = CortexClient()
K = np.array([[525, 0, 320], [0, 525, 240], [0, 0, 1]], dtype=np.float32)
aux = {"K": K, "baseline": 0.1, "hiera": 0, "valid_iters": 32}
left_image = np.array(Image.open("left.jpg"))
right_image = np.array(Image.open("right.jpg"))
depth = client.run(ModelType.FOUNDATIONSTEREO, left_image=left_image, right_image=right_image, aux_args=aux)
print(depth.shape)  # (480, 640)
```


## Related topics

- [foundationstereo](/models/cortex/foundationstereo.md)
- [fast-foundationstereo](/models/cortex/fast-foundationstereo.md)
