A C++ library for camera calibration and vision-related geometric transformations.
Install the build dependencies using your system package manager.
sudo apt update
sudo apt install -y cmake ninja-build libeigen3-dev libceres-dev nlohmann-json3-dev libgtest-dev libgmock-dev libboost-dev cli11
brew update
brew install cmake ninja eigen ceres-solver nlohmann-json googletest boost cli11
Configure and build:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release
cmake --build build -j2
Run a smoke test:
./build/examples/homography <<EOF
4
0 0 10 20
100 0 110 18
100 50 120 70
0 50 8 72
EOF
Install dependencies with vcpkg:
git clone https://github.com/microsoft/vcpkg $env:USERPROFILE\vcpkg
& $env:USERPROFILE\vcpkg\bootstrap-vcpkg.bat
& $env:USERPROFILE\vcpkg\vcpkg.exe install ceres eigen3 nlohmann-json gtest boost-pfr cli11 --triplet x64-windows
Configure and build:
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="$env:USERPROFILE\vcpkg\scripts\buildsystems\vcpkg.cmake"
cmake --build build --config Release -j2
The library exposes lightweight C++ APIs with a common optimisation interface. Typical entry points include:
optimize_intrinsics
– refine camera intrinsics and poses from planar viewsoptimize_extrinsics
– calibrate camera poses relative to a targetoptimize_handeye
– refine gripper→camera transform from motion pairsoptimize_planar_pose
– estimate single planar pose with distortionExample for hand‑eye calibration:
#include <calib/handeye.h>
using namespace calib;
std::vector<Eigen::Affine3d> base_T_gripper = ...;
std::vector<Eigen::Affine3d> camera_T_target = ...;
Eigen::Affine3d guess = ...; // initial gripper->camera transform
HandeyeOptions opts;
auto result = optimize_handeye(base_T_gripper, camera_T_target, guess, opts);
if (result.success) {
std::cout << result.report << std::endl;
std::cout << "Estimated transform:\n" << result.g_T_c.matrix() << std::endl;
}
A small calib_app
utility is available for running calibrations from JSON
files. It accepts the path to a config file and optional overrides:
calib_app --config input.json [--task intrinsics] [--output result.json]
The config file specifies the calibration input and task type, while the command-line options provided by CLI11 allow overriding the task mode or the output file.
This project maintains high code quality through:
# Install tools
sudo apt install clang-tidy cppcheck clang-format
# Run static analysis
make lint
# Format code
make format
# Generate coverage report
make coverage
For detailed documentation, see the doc directory.
This project is licensed under the MIT License - see the LICENCE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.