# Calibration Load

This example shows how to load and use calibration data from a JSON file in a pipeline to generate depth frames.

## Similar samples

 * [Calibration Flash](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_flash.md)
 * [Calibration Dump](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_dump.md)
 * [Calibration Factory Reset](https://docs.luxonis.com/software-v3/depthai/examples/calibration/calibration_factory_reset.md)

## Demo

Example script output shows a depth visualization window. The script loads calibration data from a JSON file and uses it to
configure the stereo depth pipeline.

```bash
~/depthai-core/examples/python/calibration$ python3 calibration_load.py path/to/calibration.json
# Depth window opens showing stereo depth output
# Press 'q' to quit
```

## Setup

This example requires the DepthAI v3 API, see [installation instructions](https://docs.luxonis.com/software-v3/depthai.md).

## Source code

```python
#!/usr/bin/env python3
import cv2
import depthai as dai
import argparse
import cv2

parser = argparse.ArgumentParser()
parser.add_argument("calibJsonFile", help="Path to calibration file in json")
args = parser.parse_args()

calibData = dai.CalibrationHandler(args.calibJsonFile)

with dai.Pipeline() as pipeline:
    pipeline.setCalibrationData(calibData)
    # Define sources and output
    monoLeft = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
    monoRight = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
    resolution = (640, 480)
    stereo = pipeline.create(dai.node.StereoDepth).build(
        monoLeft.requestOutput(resolution), monoRight.requestOutput(resolution)
    )
    depthQueue = stereo.depth.createOutputQueue()
    pipeline.start()
    while True:
        # blocking call, will wait until a new data has arrived
        inDepth = depthQueue.get()
        frame = inDepth.getFrame()
        # frame is ready to be shown
        cv2.imshow("depth", frame)
        if cv2.waitKey(1) == ord("q"):
            break
```

### Need assistance?

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