> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.stereolabs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.stereolabs.com/_mcp/server.

# Depth Settings

## sl::InitParameters Depth Parameters

For more information on these parameters, see the [API documentation](https://www.stereolabs.com/docs/api/structsl_1_1InitParameters.html#details) page.

### Depth Mode

Check this [page](/docs/development/zed-sdk/modules/depth-sensing/depth-modes/) to get more insights about the currently available depth modes for the ZED cameras.

### Depth Precision

For the `NEURAL` depth mode, `InitParameters::depth_precision` selects the numerical precision of the neural network inference. `DEPTH_PRECISION::FP16` is the default. `DEPTH_PRECISION::INT8` runs the network at a lower precision, reducing GPU memory usage and increasing speed for a small (typically 1-2%) accuracy cost.

> **Note**
>
> `INT8` is only available for the `NEURAL` depth mode; other depth modes always run in `FP16`. It is always safe to set: the ZED SDK falls back to `FP16`, and logs it, when the depth mode or the GPU does not support `INT8`.

**`C++`**

```cpp C++
InitParameters init_parameters;
init_parameters.depth_mode = DEPTH_MODE::NEURAL;
init_parameters.depth_precision = DEPTH_PRECISION::INT8; // Use INT8 neural depth inference
```

**`Python`**

```python Python
init_parameters = sl.InitParameters()
init_parameters.depth_mode = sl.DEPTH_MODE.NEURAL
init_parameters.depth_precision = sl.DEPTH_PRECISION.INT8 # Use INT8 neural depth inference
```

**`C#`**

```csharp C#
InitParameters init_parameters = new InitParameters();
init_parameters.depthMode = DEPTH_MODE.NEURAL;
init_parameters.depthPrecision = DEPTH_PRECISION.INT8; // Use INT8 neural depth inference
```

### Depth Range

Depth range corresponds to the minimum and maximum distance at which the depth of an object can be estimated.

#### Depth Range by Camera Model

Below are the typical depth ranges and focal lengths for each ZED camera model:

#### ZED Mini

|                       | ZED Mini                     |
| --------------------- | ---------------------------- |
| **Focal Length**      | 3mm                          |
| **Max Depth Range**   | 0.1m to 15m (0.3ft to 49ft)  |
| **Ideal Depth Range** | 0.1m to 9m (0.3ft to 29.5ft) |

#### ZED 2i

|                       | ZED 2i - Wide                 | ZED 2i - Narrow                |
| --------------------- | ----------------------------- | ------------------------------ |
| **Focal Length**      | 2.1mm                         | 4.6mm                          |
| **Max Depth Range**   | 0.3m to 20m (1.0ft to 65.6ft) | 1.5m to 35m (4.9ft to 114.8ft) |
| **Ideal Depth Range** | 0.3m to 12m (1.0ft to 39.4ft) | 1.5m to 20m (4.9ft to 65.6ft)  |

#### ZED X

|                       | ZED X - Wide                   | ZED X - Narrow                 |
| --------------------- | ------------------------------ | ------------------------------ |
| **Focal Length**      | 2.2mm                          | 4.6mm                          |
| **Max Depth Range**   | 0.3m to 20m (0.98ft to 65.6ft) | 1.0m to 35m (3.3ft to 114.8ft) |
| **Ideal Depth Range** | 0.3m to 12m (0.98ft to 39.4ft) | 1.0m to 20m (3.3ft to 65.6ft)  |

#### ZED X Mini

|                       | ZED X Mini - Wide            | ZED X Mini - Narrow            |
| --------------------- | ---------------------------- | ------------------------------ |
| **Focal Length**      | 2.2mm                        | 4.6mm                          |
| **Max Depth Range**   | 0.1m to 8m (0.3ft to 26.2ft) | 0.15m to 12m (0.5ft to 39.4ft) |
| **Ideal Depth Range** | 0.1m to 4m (0.3ft to 13.1ft) | 0.15m to 6m (0.5ft to 19.7ft)  |

#### ZED X Nano

|                       | ZED X Nano                       |
| --------------------- | -------------------------------- |
| **Focal Length**      | 2.8mm                            |
| **Max Depth Range**   | 0.03m to 2.0m (0.1ft to 6.56ft)  |
| **Ideal Depth Range** | 0.05m to 1.5m (0.16ft to 4.92ft) |

### Minimum Range

You can adjust the minimum detectable depth by setting `depth_minimum_distance` in `InitParameters`. Lowering this value allows the camera to estimate depth for objects closer to the lens, within the hardware's supported range.

**`C++`**

```cpp C++
InitParameters init_parameters;
init_parameters.coordinate_units = UNIT::METER;
init_parameters.depth_minimum_distance = 0.15; // Set the minimum depth perception distance to 15cm
```

**`Python`**

```python Python
init_parameters = sl.InitParameters()
init_parameters.coordinate_units = sl.UNIT.METER
init_parameters.depth_minimum_distance = 0.15 # Set the minimum depth perception distance to 15cm
```

**`C#`**

```csharp C#
InitParameters init_parameters = new InitParameters();
init_parameters.coordinateUnits = UNIT.METER;
init_parameters.depthMinimumDistance = 0.15f ; // Set the minimum depth perception distance to 15cm
```

### Maximum Range

You can increase the maximum detectable depth by setting `depth_maximum_distance` in `InitParameters`. Raising this value allows the camera to estimate depth for objects farther from the lens, up to the hardware's supported maximum range.

This is useful for applications that require depth information at longer distances.

Depth accuracy decreases with distance, so it's important to consider the trade-off between range and accuracy. Read more about [depth accuracy](/docs/development/zed-sdk/modules/depth-sensing/#depth-accuracy) to understand how it affects your application.

**`C++`**

```cpp C++
InitParameters init_parameters;
init_parameters.depth_mode = DEPTH_MODE::NEURAL ;  // Set the depth mode to NEURAL
init_parameters.coordinate_units = UNIT::METER;
init_parameters.depth_maximum_distance = 40;      // Set the maximum depth perception distance to 40m
```

**`Python`**

```python Python
init_parameters = sl.InitParameters()
init_parameters.depth_mode = sl.DEPTH_MODE.NEURAL  # Set the depth mode to NEURAL
init_parameters.coordinate_units = sl.UNIT.METER
init_parameters.depth_maximum_distance = 40       # Set the maximum depth perception distance to 40m
```

**`C#`**

```csharp C#
InitParameters init_parameters = new InitParameters();
init_parameters.depthMode = DEPTH_MODE.NEURAL ;    // Set the depth mode to NEURAL
init_parameters.coordinateUnits = UNIT.METER;
init_parameters.depthMaximumDistance = 40;        // Set the maximum depth perception distance to 40m
```

> **Tip**
>
> * The maximum depth range can be reduced to clamp values above a certain distance. This is useful to reduce depth jitter at long distances.
> * Increasing the maximum range has no impact on memory or FPS.

### Depth Stabilization

Depth stabilization is a feature that reduces depth map jitter and enhances accuracy by temporally filtering depth data across multiple frames. It leverages the ZED SDK's positional tracking to maintain stable depth estimates even when the camera is in motion. The system intelligently distinguishes between static and dynamic regions, ensuring that moving objects are not incorrectly fused, which preserves the integrity of depth information in dynamic scenes.

Depth stabilization is enabled by default. Since it enables positional tracking in the background, you can disable depth stabilization by setting `init_parameters.depth_stabilization = 0` to improve computational performance. The value sets the stabilization strength, from 0 (disabled) to 100.

> **Tip**
>
> * For fixed cameras, we recommend enabling `PositionalTrackingParameters::set_as_static` while using depth stabilization. This allows the depth stabilizer module to know the camera is static so it can disable visual tracking and reduce the computational load.
> * For applications requiring the Positional Tracking module to be disabled, the depth stabilization parameter must be set to 0; otherwise, the Positional Tracking module is automatically activated in the background.
> * Enabling depth stabilization uses temporal tracking to smooth depth over time. However, if the stabilization strength is set too high and objects or the camera move quickly, the system may fail to keep up, causing "ghosting" or motion trails around fast-moving objects. By default, the Depth Stabilization parameter is set to 30.

## sl::RuntimeParameters Depth Parameters

For more information on these parameters, see the [API documentation](https://www.stereolabs.com/docs/api/structsl_1_1RuntimeParameters.html) page.

### Depth Confidence Filtering

Depth estimation can introduce some uncertainty, resulting in points with varying reliability. While a small number of inaccurate points may not impact most applications, scenarios requiring high precision benefit from filtering out less reliable depth data.

To help with this, the ZED SDK provides a confidence map. Each pixel in the confidence map is assigned a value from 0 (high confidence) to 100 (low confidence). Pixels with higher values are less trustworthy and can be excluded or handled differently to improve the overall quality of your depth data.

**`C++`**

```cpp C++
sl::Mat confidence_map;
zed.retrieveMeasure(confidence_map, sl::MEASURE::CONFIDENCE);
```

**`Python`**

```python Python
confidence_map = sl.Mat()
zed.retrieve_measure(confidence_map, sl.MEASURE.CONFIDENCE)
```

**`C#`**

```csharp C#
Mat confidence_map = new Mat();
zed.RetrieveMeasure(confidence_map, MEASURE.CONFIDENCE);
```

To filter out unreliable points from the depth map or point cloud, you can either implement your own filtering function using the retrieved confidence data, or simply set the [`sl::RuntimeParameters::confidence_threshold`](https://www.stereolabs.com/docs/api/structsl_1_1RuntimeParameters.html) parameter. When you set this threshold, the ZED SDK automatically removes all points with a confidence value higher than the specified limit, streamlining the process and ensuring only reliable depth data is used.

Two different types of confidence thresholds are available:

* `confidence_threshold`: Filters out depth points with low confidence, primarily removing unreliable measurements around object edges. This helps prevent objects that are close together from appearing "linked" in the depth map.
* `texture_confidence_threshold`: Filters out depth points in regions with low image texture (uniform or featureless areas), where depth estimation is less reliable due to insufficient visual information.

| Image                                                                                                 | Original Depth                                                                                          |
| ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| ![RGB image of office](/_fern-img/7287694a22a981e477bc6e23a6a315849e088ca78c9692025f0ac7b83b1d0d86.webp) | ![Depth map of office](/_fern-img/68688567990c558da80d48f1bf17512c2c30c3277027478d206fdc3fc27c13b8.webp) |

| `confidence_threshold` set to 50                                                                                               | `texture_confidence_threshold` set to 50                                                                                                       |
| ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| ![Depth with confidence threshold](/_fern-img/a1eb79941e5f24de7edc94104feef8f9940437f36bc458069bfce3b656212c52.webp) | ![Depth with texture confidence threshold](/_fern-img/f7a851b590fbd8f3958c775f684a82d7da2022dc05bcbc7f155f80c3e271396c.webp) |