> 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.

# Tutorial - Health Status

This tutorial shows how to enable the camera's image and sensor health checks and read the detailed health status returned by the SDK. It reports whether the current frame is corrupted, and flags low image quality, low lighting, low depth reliability and low motion-sensor reliability, so your application can detect and react to degraded camera conditions in real time.

## Getting Started

* First, download the latest version of the [ZED SDK](https://www.stereolabs.com/developers/).
* Download the [Health Status](https://github.com/stereolabs/zed-sdk/tree/master/tutorials/tutorial%2011%20-%20health%20status) sample code in C++.

## Code Overview

### Open the camera with the image validity check enabled

As in previous tutorials, we create, configure and open the ZED. Here, we also set `enable_image_validity_check` in `InitParameters`: a value of `1` enables the base health check, while higher values (`2`, `3`) progressively enable image-quality and blur/quality verification at extra computational cost.

**`C++`**

```cpp C++
// Create a ZED camera object
Camera zed;

// Set configuration parameters
InitParameters init_parameters;
init_parameters.camera_resolution = RESOLUTION::AUTO; // Use HD720 or HD1200, depending on camera type
init_parameters.camera_fps = 30;
init_parameters.depth_mode = sl::DEPTH_MODE::NEURAL;
// '1' enables the health check, higher values enable more advanced verification (see documentation)
// but also increase the computation time. '2' adds image quality checks (absolute quality, and
// difference between left and right), '3' adds advanced blur and quality checks.
init_parameters.enable_image_validity_check = 1;

// Open the camera
auto returned_state = zed.open(init_parameters);
if (returned_state > ERROR_CODE::SUCCESS) {
    cout << "Error " << returned_state << ", exit program." << endl;
    return EXIT_FAILURE;
}
```

### Detect corrupted frames

If the health check detects a corrupted frame, `grab()` returns the `CORRUPTED_FRAME` warning instead of `SUCCESS` (both are non-fatal: any error code lower than or equal to `ERROR_CODE::SUCCESS` still means a new image is available).

**`C++`**

```cpp C++
returned_state = zed.grab();
if (returned_state == ERROR_CODE::CORRUPTED_FRAME) {
    // If the health check detects a corrupted frame, grab() returns a warning error code: ERROR_CODE::CORRUPTED_FRAME
    // CORRUPTED_FRAME is a warning (lower than ERROR_CODE::SUCCESS), so it must be tested first
    cout << "**** Corrupted frame detected ! *****" << endl;
} else if (returned_state <= ERROR_CODE::SUCCESS) {
    // A new image is available if grab() returns ERROR_CODE::SUCCESS or a WARNING (an error_code lower than ERROR_CODE::SUCCESS)
} else {
    cout << "Error " << returned_state << endl;
}
```

### Read the detailed health status

Beyond the per-frame `grab()` result, `Camera::getHealthStatus()` returns a [`HealthStatus`](https://www.stereolabs.com/docs/api/structsl_1_1HealthStatus.html) structure with independent indicators for image quality, lighting, depth and motion-sensor reliability.

**`C++`**

```cpp C++
// Get the detailed health status
auto health = zed.getHealthStatus();
std::cout << "Health check enabled " << health.enabled << std::endl;
std::cout << "low_image_quality " << health.low_image_quality << std::endl;
std::cout << "low_lighting " << health.low_lighting << std::endl;
std::cout << "low_depth_reliability " << health.low_depth_reliability << std::endl;
std::cout << "low_motion_sensors_reliability " << health.low_motion_sensors_reliability << std::endl;
```

> **Note**
>
> `low_image_quality` and `low_lighting` are only evaluated when `enable_image_validity_check` is set to `2` or higher.

### Close the camera

**`C++`**

```cpp C++
// Close the camera
zed.close();
```