Calibration
Calibrate your Stereo Camera for CoreVisionX
Computing high quality depth maps from your stereo images requires accurate intrinsic and extrinsic calibration. CoreVisionX makes this process easy with our calibration CLI.
Install Calibration Tools
First create a new directory for our calibration project to live. This will help us keep track of data we collect during calibration.
mkdir stereo-calibration-demo && cd stereo-calibration-demoNext initialize the python project. We recommend using pixi
pixi init
✔ Created /Users/bencaunt/Documents/stereo-calibration-demo/pixi.tomlThen in pixi.toml add preview = ["pixi-build"]
[workspace]
authors = ["Ben Caunt <[email protected]>"]
channels = ["conda-forge"]
name = "stereo-calibration-demo"
platforms = ["osx-arm64"]
version = "0.1.0"
preview = ["pixi-build"] # add this line here!
[tasks]
[dependencies]Once that is done we can install our calibration package. This contains the CLI tools needed to generate a CoreVisionX compatible calibration file.
CoreVisionX/CoreVisionX-calibration is a private repository. You will need to authenticate with Git before pixi can clone it. This can be accomplished using the gh_auth_login cli command: https://cli.github.com/manual/gh_auth_login
Calibrating your Camera
For this step you will need your CoreVisionX camera plugged into your computer with the included USB-C cable. You will also need a calibration checkerboard printed.
Capturing Data
To begin capturing data run

Above we can see what the view looks like for the stereo calibration process. We want to ensure that both lenses can "see" the checkerboard. We know this is the case when the colored lines are displayed such as in the above image. If you cannot see the lines move the camera closer and double check the columns / rows set in the command above. Pressing space will capture an image. We want to capture around 10-30 images. In each image we want the checkerboards to be taking up as much of the field of view as possible.
The arguments are critical at this stage. Width is the camera width in pixels. This is the width of BOTH stereo frames concatenated together. If you want to use a different resolution you will need to redo calibration. cols / rows refers to the dimensions of the checkerboard. By convention we use N-1 as the argument so a 10x7 checkerboard has 9 cols and 6 rows. Finally square is the square size in meters. We recommend measuring your squares with calipers incase there was scaling issues with your print settings.
Running this process will give you data.npz which contains our collected images.
Next we will calibrate the Intrinsics and Extrinsic of our camera from the collected data:
Which should output similar to the following:
Knowing how to read the calibrated data can be helpful for debugging. For example, R and T are the rotation matrix and translation vector between the two lenses. The particular stereo camera used in this example has a baseline of 6cm which lines up well with our calibrated values.
This calibration process will give a second binary called calib.npz this is important to hold onto and it is a good idea to label this as it is specific to the camera being calibrated. Using the same calibration file between different cameras will have poor accuracy. We can check the quality of the output using the preview command.

Here you can see the rectified output. Notice how the parallel lines across the screen line up perfectly in both frames. If this is the case with your camera then you have successfully calibrated your camera and can go onto using your camera for depth applications!
Last updated