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

# Samples - Virtual Stereo

This sample shows how to pair two [ZED X One](/docs/products/cameras/zedxone/) monocular cameras into a calibrated **virtual stereo rig**, letting the ZED SDK compute depth from two independent mono sensors as if they were a single stereo camera like the ZED 2i or ZED X. For background on why and how to build such a rig (baseline selection, hardware synchronization), see [Dual Camera Stereo Vision](/docs/products/cameras/zedxone/dual-camera-stereo-vision/).

## Getting Started

* First, download the latest version of the [ZED SDK](https://www.stereolabs.com/developers/).
* Download the [Virtual Stereo](https://github.com/stereolabs/zed-sdk/tree/master/virtual%20stereo) sample code in C++.

## Overview

The sample opens two ZED X One cameras (identified either by camera ID or by serial number) and combines them into a virtual stereo pair using a generated virtual serial number:

**`C++`**

```cpp C++
// From the 2 ZED X One cameras serial numbers, defining the Left and Right cameras of the virtual stereo rig
unsigned int virt_sn = generateVirtualStereoSerialNumber(serial_left, serial_right);
init_parameters.input.setVirtualStereoFromSerialNumbers(serial_left, serial_right, virt_sn);

// Or, identifying the cameras by their ID instead of their serial number
init_parameters.input.setVirtualStereoFromCameraIDs(1, 0, virt_sn);
```

Once opened, the virtual stereo rig behaves like any other ZED camera: it exposes rectified left/right views and, if the rig has been calibrated, standard stereo depth. If the rig hasn't been calibrated yet, only unrectified images (`VIEW::LEFT_UNRECTIFIED` / `VIEW::RIGHT_UNRECTIFIED`) and recording are available.

> **Note**
>
> The two ZED X One cameras should be hardware-synchronized (via a ZED Link capture card, ZED Box Orin, or ZED Box Mini) for accurate depth perception.