# Dual Stereo Example

Build front and rear depth views on one [OAK4 FFC](https://docs.luxonis.com/hardware/platform/deploy/oak4-ffc-getting-started.md).
Use this layout to evaluate opposite viewing directions on a robot. `CAM_B` + `CAM_C` face forward; `CAM_D` + `CAM_E` face
backward. Each pair needs overlapping views.

> **Viewer preview**
> Viewer shows one pair at a time. Simultaneous front and rear processing requires an application pipeline.

## What you need

Hardware

 * 1× [OAK4 FFC](https://shop.luxonis.com/products/oak-4-ffc) baseboard
 * 4× stereo camera modules, matched in sensor and optics within each pair, for example
   [OAK-FFC-V2-OV9282](https://shop.luxonis.com/products/oak-ffc-v2-ov9282?Configuration=Standard+%C2%B7+Mono+%C2%B7+Fixed+focus)
   or
   [OAK-FFC-V2-OG05-M](https://shop.luxonis.com/products/oak-ffc-v2-og05?Configuration=Standard+%C2%B7+Mono+%C2%B7+Fixed+focus).
   See all [supported camera modules](https://docs.luxonis.com/hardware/platform/deploy/oak4-ffc-getting-started.md).
 * 4× FFC cables, which come with the camera modules
 * 1× [OAK-FFC Kit](https://shop.luxonis.com/products/oak-ffc-kit) or another rigid rail with 4 module holders
 * Power supply and network connection, as described in [Getting
   Started](https://docs.luxonis.com/hardware/platform/deploy/oak4-ffc-getting-started.md)

Tools

 * Computer with OAK Viewer
 * Ruler or caliper

You can configure the OAK4 FFC together with its camera modules in the [Luxonis
shop](https://shop.luxonis.com/products/oak-4-ffc).

## Assemble and wire the rig

| Sockets | Role | Orientation |
| --- | --- | --- |
| `CAM_B` + `CAM_C` | Front stereo pair | Both upright, facing forward, with overlapping views |
| `CAM_D` + `CAM_E` | Rear stereo pair | Both upright, facing backward, with overlapping views |

Label left/right looking in each pair's viewing direction.

Disconnect power. Secure the baseboard and holders. Keep each pair on one rigid part, with both modules upright; turn the rear
pair backward.

Choose each pair's baseline for its working distance. Tighten the holders, then measure each camera center's X/Y/Z offset from
`CAM_B` in centimeters, including the separation between front and rear mounting planes.

With power disconnected, connect the sockets listed above. Check contact orientation, label the cables and secure them without
pulling on the modules.

Power the rig and connect it to the computer's network. Inspect all four streams in Viewer; cover each lens briefly to confirm its
socket and direction.

## Configure extrinsics in OAK Viewer

 1. Click Connect on the device card.
 2. Back up the existing calibration. In the sidebar, under Device, click FFC Calibration, then click Reset Extrinsics.
 3. Select `CAM_C`, keep Relative to set to `CAM_B`, and enter its measured translation in centimeters. Leave the rotation at
    zero, because it faces the same way as `CAM_B`.
 4. Select `CAM_D` and `CAM_E` and enter their measured translations. Translations use [RDF
    axes](https://docs.luxonis.com/software-v3/depthai/depthai-components/coordinate-systems.md) (+X right, +Y down, +Z forward),
    so the rear cameras, mounted behind `CAM_B`, have a negative Z translation. Set their orientation to match the
    backward-facing, upright modules.
 5. Check that the 3D view matches the physical layout of your rig. The yellow tab on each camera marks its physical top, and the
    view cone shows the direction it faces.
 6. Click Save and Start Calibration. OAK Viewer saves the extrinsics and starts Dynamic Calibration.

## Run Dynamic Calibration

Follow [Calibrate a stereo pair in Viewer](https://docs.luxonis.com/hardware/platform/deploy/oak4-ffc-getting-started.md). Viewer
calibrates the front pair first and then the rear pair; point each pair at a textured scene while its group is active, and confirm
both groups finish successfully.

## View depth from both pairs

OAK Viewer shows depth from one stereo pair at a time. You choose the pair in the pipeline configuration.

In the sidebar, under Pipelines, open Neural 3D. The default stereo pair uses the front cameras, and the view shows their depth
stream and point cloud.

Click Configure in the top bar and open the Preview tab. Under Stereo Pair, set Left Sensor and Right Sensor to the rear cameras.
The Alignment Sensor follows your selection. Click Save Stereo Pair, and the pipeline restarts with the rear pair.

> **Left and right swap for the rear pair**
> Select Left Sensor and Right Sensor looking in the rear cameras' viewing direction.

## Verify the result

 * Confirm Calibration Details reports successful calibration for both groups.
 * Compare a textured object's depth with a measured distance, first in front and then behind the rig.
 * Reconnect to verify calibration persists. Recalibrate after moving a camera or changing optics.

Check the selected rear sockets and their left/right order. Recheck measured camera spacing if distances are consistently scaled
incorrectly. Combining both clouds later also requires verifying the relative poses between the front and rear pairs.

## Next steps

 * [Three Camera Stereo
   Example](https://docs.luxonis.com/hardware/platform/deploy/oak4-ffc-getting-started/three-camera-stereo.md) - color and stereo
   depth looking at the same scene
 * [DynamicCalibration](https://docs.luxonis.com/software-v3/depthai/depthai-components/host_nodes/dynamic_calibration.md) - use
   Dynamic Calibration in your own DepthAI pipeline
 * [Compare example camera setups](https://docs.luxonis.com/hardware/platform/deploy/oak4-ffc-getting-started.md)
