Interfacing Ceres Solver with Numpy via C/C++ API
Example project how to use ceres solver to fit a 2D Gaussian to an image: ceres_solver_example_2023_OCT_26.zip
Compile: make all
Test: python3 test.py
- General computational framework:
numpy: https://numpy.org/ (The fundamental package for scientific computing with Python) - Optimization / fitting is done with:
ceres solver: http://ceres-solver.org/ (A Large Scale Non-linear Optimization Library) - Python/C++ interface is generated with:
swig: https://www.swig.org/ (Simplified Wrapper and Interface Generator) - Some features are taken from:
scipy: https://scipy.org/ (Fundamental algorithms for scientific computing in Python)
Interfacing Ceres Solver with Adept for automatic differentiation
General information about automatic differentation
- https://en.wikipedia.org/wiki/Automatic_differentiation
- https://en.wikipedia.org/wiki/Adept_(C%2B%2B_library)
ceres_solver_autodiff_2023_Nov_27.zip
- Ceres Solver has its internal implementation of automatic differentation, but there is no API for directly using it
- Aim: determine the number of fit parameters at run time and not via template parameters at compile time
- Use adept for automatic differentation in a way that multi-threading for ceres solver is still possible
- Avoid to create a an adept stack object every time the evaluate() function is called by ceres solver