Scripts
This package provides a set of scripts for camera calibration and validation. These scripts are installed with the package and can be run from the command line. All usages are available with the -h/--help flag.
cv-find-chessboards
cv-find-chessboards finds chessboards in a set of images and saves the detected correspondences to a directory of .npz files.
Example usage:
cv-find-chessboards 6 9 0.05 -o outputs/ images/*.png
images/*.png and save the detected chessboard correspondences to the outputs/ directory.
To process in parallel, specify the -j/--jobs flag with the number of worker processes to use.
cv-find-charucoboards
cv-find-charucoboards finds ChArUco boards in a set of images and saves the detected correspondences to a directory of .npz files.
Example usage:
cv-find-charucoboards 6 9 0.05 0.03 4X4_100 -o outputs/ images/*.png
This example will find 9x6 square ChArUco boards with a square size of 0.05 units, a marker size of 0.03 units, and a dictionary of 4x4 markers with 100 markers in images images/*.png and save the detected ChArUco board correspondences to the outputs/ directory.
Legacy ChArUco boards1 can be specified with the -l/--legacy flag.
cv-mono-calibrate
cv-mono-calibrate calibrates a monocular camera from a set of saved correspondences.
Example usage:
cv-mono-calibrate 1920 1080 outputs/*.npz
This example will calibrate a camera with a resolution of 1920x1080 from the correspondences saved in outputs/*.npz. The calibration results will be printed to stdout in a human-readable format.
Distortion models can be specified with -r/--rational, -p/--thin-prism, and/or -t/--tangential flags.
To print in a different format, specify the -f/--format flag.
cv-stereo-calibrate
cv-stereo-calibrate calibrates a stereo camera from a two sets of saved correspondences.
The correspondences' filenames should be numeric and match between the two sets. For example, left/0000.npz and right/0000.npz will be matched together. cv-stereo-calibrate involves a matching step that will attempt to match correspondences with similar filenames by number. A threshold on the maximum difference between filenames must be specified, but can be set to 0 in the case of identical filenames.
Example usage:
cv-stereo-calibrate 1920 1080 left_outputs/ right_outputs/ 0
This example will calibrate a stereo camera with a resolution of 1920x1080 from the correspondences saved in left_outputs/*.npz and right_outputs/*.npz. The calibration results will be printed to stdout in a human-readable format. The maximum difference between filenames is set to 0 to indicate that the filenames should be identical numbers.
Distortion models can be specified with -r/--rational, -p/--thin-prism, and/or -t/--tangential flags.
To print in a different format, specify the -f/--format flag.
-
Legacy = ChArUco boards generated with OpenCV prior to version 4.7.0. ↩