# Multi-Device Calibration

Give your OAK devices a shared view of the world. Multi-Device Calibration estimates where devices sit relative to one another, so
their camera data can be expressed in one coordinate system.

Factory-calibrated OAK4 cameras already store the relative positions and orientations of their camera modules (CCMs). An OAK FFC
rig needs calibration between its CCMs after assembly. Combining data from several calibrated devices also requires knowing the
positions and orientations between devices. Multi-Device Calibration estimates those relationships from images of a shared scene.

> **Availability**
> Available for RVC4 devices with DepthAI v3.11.0 or later. Calibration runs on the host. The integration uses a [Beta API](https://docs.luxonis.com/software-v3/depthai/examples/beta-features.md), which may change between releases.

## What you can build

### Combine point clouds

Express points from multiple devices in one coordinate system. This demo shows the bin and tools in the setup photo below.

[Explore PointCloud](https://docs.luxonis.com/software-v3/depthai/depthai-components/host_nodes/pointcloud.md)

### Stitch camera views

Compose overlapping images into a wider view, indoors or outdoors. Click the plaza panorama to inspect it at full size.

[Explore Stitching](https://docs.luxonis.com/software-v3/depthai/depthai-components/host_nodes/stitching.md)

## From separate cameras to a shared coordinate system

Calibration chooses one device as the reference and estimates the position and orientation of every other device relative to it.
These relationships form a calibration graph.

Here, devices B and C are located relative to device A. Each arrow describes how to convert coordinates from that device into A's
coordinate system. The diagram uses `CAM_A` as each device's local origin; the cameras used to collect calibration images can be
different.

Your application applies this graph to a DepthAI pipeline. Camera frames then carry the shared coordinate information for
downstream processing, such as point cloud generation or stitching.

## Prepare your setup

 * Use at least two devices. Register at least one camera from each device for calibration.
 * Give the cameras overlapping views. All registered cameras need to see a shared scene with enough detail to match features
   across images. A textured wall or cluttered room works better than a blank wall.
 * Keep the scene and devices still. Do not move the devices or objects in the shared view while collecting calibration images.
 * Provide a known distance. Images alone cannot determine real-world distances. Use a factory-calibrated stereo pair on at least
   one device, or supply a measured distance between the centers of two registered cameras on different devices.

The integration example uses the stereo cameras on both devices, taking the known distance from their existing calibration. A
setup with one camera per device needs a measured distance instead.

Two devices viewing the same scene from different positions. Keep their mounts fixed while collecting calibration images.

## Calibrate, save and apply

 1. Collect images. Run a calibration pipeline with the cameras you want to use. The calibration node groups their images and
    collects a set of samples.
 2. Estimate the device positions. The node returns one result, including whether calibration succeeded, the calibration graph and
    quality metrics. If it fails, check the reported reason and adjust the setup before trying again.
 3. Save the result. Store the successful graph as a JSON file for use by your application.
 4. Apply it to your application. Load the graph into the pipeline that combines the camera data. Applying calibration is an
    explicit application step; collecting a result does not apply it automatically.

### Integrate MultiDeviceCalibration

Start with a complete Python example that calibrates two stereo devices and saves the result. Find camera registration options,
measured-distance constraints, lifecycle commands and troubleshooting on the technical page.

[Open the code and API
guide](https://docs.luxonis.com/software-v3/depthai/depthai-components/host_nodes/multi_device_calibration.md)

## Which calibration do you need?

| Goal | Guide |
| --- | --- |
| Recalibrate the camera relationships within an OAK device. | [Dynamic
Calibration](https://docs.luxonis.com/hardware/platform/depth/dynamic-calibration.md) |
| Estimate the positions and orientations between multiple OAK devices. | Multi-Device Calibration, described on this page. |
| Perform full stereo or ToF calibration with calibration tools and targets. | [Manual
Calibration](https://docs.luxonis.com/hardware/platform/depth/manual-calibration.md) |

Spatial calibration and frame synchronization solve different problems: calibration tells you where cameras are; synchronization
aligns when they capture images. For shared pipelines and frame synchronization, see [Multi-Device
Pipelines](https://docs.luxonis.com/software-v3/depthai/depthai-components/multi-device.md).

### Need assistance?

Head over to [Discussion Forum](https://discuss.luxonis.com/) for technical support or any other questions you might have.
