AutoCalibration
AutoCalibration is a host node that runs automatic stereo calibration workflows in a pipeline and provides calibration quality results during runtime.It is important to separate the two layers:AutoCalibrationis a host node that you add to your pipeline.- Internally, it controls and uses
DynamicCalibrationin the background. DEPTHAI_AUTOCALIBRATIONis a global deployment switch recognized by depthai-core.
Two ways to enable automatic calibration
- Global variable (
DEPTHAI_AUTOCALIBRATION) Best for deployed pipelines where you want to enable automatic behavior without changing code. - AutoCalibration host node Best when you want explicit pipeline-level control over mode, retries, validation, flashing, and result handling.
Automatic calibration via global variable
Command Line
1DEPTHAI_AUTOCALIBRATION=ON_START
2DEPTHAI_AUTOCALIBRATION=CONTINUOUSBehavior notes
- Applies to stereo
1280x800pipelines. - Flashes calibration as user calibration.
- Factory calibration remains untouched.
- If your pipeline already integrates
DynamicCalibrationdirectly, this automatic procedure is not initialized.
In both
ON_START and CONTINUOUS procedures, the new calibration is flashed as user calibration. This overwrites the existing user calibration currently stored on the device.ON_START procedure
Example
Command Line
1DEPTHAI_AUTOCALIBRATION=ON_START python3 examples/Stereo/stereo.pyCommand Line
1DEPTHAI_LEVEL=info DEPTHAI_AUTOCALIBRATION=ON_START python3 examples/Stereo/stereo.py- Fast path: about
2.5s. - Common retry path: about
6s. - Worst-case retries (
maxIterations = 10): up to about25s.
CONTINUOUS procedure
Example
Command Line
1DEPTHAI_AUTOCALIBRATION=CONTINUOUS python3 examples/Stereo/stereo.pyCommand Line
1DEPTHAI_LEVEL=info DEPTHAI_AUTOCALIBRATION=CONTINUOUS python3 examples/Stereo/stereo.pyON_START.AutoCalibration host node in your pipeline
Example
Python
C++
Python
Python
1import cv2 as cv
2import numpy as np
3import depthai as dai
4
5# Create pipeline
6with dai.Pipeline() as pipeline:
7 device = pipeline.getDefaultDevice()
8 botchCalibration(device)
9
10 camLeft = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_B)
11 camRight = pipeline.create(dai.node.Camera).build(dai.CameraBoardSocket.CAM_C)
12 stereo = pipeline.create(dai.node.StereoDepth)
13
14 dcWorker = pipeline.create(dai.node.AutoCalibration).build(camLeft, camRight)
15 dcWorker.initialConfig.maxIterations = 2
16 dcWorker.initialConfig.sleepingTime = 10
17 dcWorker.initialConfig.flashCalibration = False
18 dcWorker.initialConfig.mode = dai.AutoCalibrationConfig.CONTINUOUS # ON_START
19 dcWorker.initialConfig.validationSetSize = 5
20 dcWorker.initialConfig.dataConfidenceThreshold = 0.7
21 workerOutputQueue = dcWorker.output.createOutputQueue()
22
23 videoQueueLeft = camLeft.requestOutput((1280, 800), fps=30)
24 videoQueueRight = camRight.requestOutput((1280, 800), fps=30)
25
26 videoQueueLeft.link(stereo.left)
27 videoQueueRight.link(stereo.right)
28
29 stereoOut = stereo.depth.createOutputQueue()
30 pipeline.start()
31
32 while pipeline.isRunning():
33 workerOutput = workerOutputQueue.tryGet()
34 if workerOutput is not None:
35 if workerOutput.passed:
36 print("Passed")
37 print(f"dataConfidence = {workerOutput.dataConfidence}")
38 print(f"calibrationConfidence = {workerOutput.calibrationConfidence}")
39 else:
40 print("Did not pass")
41
42 depth = stereoOut.get()
43 cv.imshow("Depth", depth)
44
45 if cv.waitKey(1) == ord("q"):
46 break
47
48 pipeline.stop()Configuration Parameters
auto_calib.initialConfig:modeSelects the automatic calibration procedure (ON_STARTorCONTINUOUS).flashCalibrationIftrue, calibration is flashed as user calibration after successful validation.maxIterationsMaximum number of calibration attempts.sleepingTimeDelay between calibration attempts/iterations.validationSetSizeNumber of validation samples used before accepting calibration.
When flashing is enabled and a calibration passes validation, the previous user calibration on the device is overwritten.
Node Output (Result)
AutoCalibrationResult messages. Common fields:passedWhether calibration/validation succeeded.dataQualityQuality indicator of the collected calibration data.calibrationConfidenceConfidence score for the resulting calibration.
Availability and rollout status
- Startup automatic calibration is available for
depthaiversions greater than3.5.0. DepthAI 3.5.0provides this as an opt-in beta throughDEPTHAI_AUTOCALIBRATION.
Command Line
1python3 -m pip install depthai==3.5.0Feedback
AutoCalibration is an actively evolving feature. If you want to help shape it, use the node in real deployments and share feedback with us on GitHub: what worked well, what failed, and what parameters or outputs you want to see improved. We prioritize API improvements based on user feedback.- Forum: discuss.luxonis.com
- GitHub: luxonis/depthai-core
- For calibration data collection during debugging, use Stereo Tuning Assistance and attach the captured zip folder.
Reference
class
dai::node::AutoCalibration
variable
std::shared_ptr< AutoCalibrationConfig > initialConfig
variable
Output output
function
std::shared_ptr< AutoCalibration > build(const std::shared_ptr< Camera > & cameraLeft, const std::shared_ptr< Camera > & cameraRight)function
~AutoCalibration()function
void run()function
void setRunOnHost(bool runOnHost)function
bool runOnHost()function
void buildInternal()inline function
DeviceNodeCRTP()inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props)inline function
DeviceNodeCRTP(std::unique_ptr< Properties > props, bool confMode)inline function
DeviceNodeCRTP(const std::shared_ptr< Device > & device, std::unique_ptr< Properties > props, bool confMode)enum
Need assistance?
Head over to Discussion Forum for technical support or any other questions you might have.