OpenFrameworks addon / helpers for working with Google Ceres solver
Notes on glm and ceres-solver
To effectively use ceres, the solver requires the derivative of your cost function with respect to the model parameters. This derivative is called the Jacobian. The Jacobian can become complicated and intensive for the programmer to compute when you have complicated mathematics going on. Ceres therefore offers an automatic differentiation feature which will automatically compute the derivative for you. In order for this to work, it must pass a special data type through your math functions in order to calculate the differentiation, therefore your maths functions must be templated.
Here we exploit the feature of glm whereby all major maths functions are templated. However, there are some caveats and problem cases. Generally these issues come out as compile errors. Here we explain some strategies to avoid compile errors:
- ceres doesn't play nice with swizzle and some of the other features of glm, therefore I suggest that you set
ofxCeres.propsalready includes this define.
- Some of the maths functions of glm aren't working well. You can find some replacement functions in the
ofxCeres::VectorMathnamespace which should work as expected. Check [https://github.com/g-truc/glm/issues/973] for notes on why this is.