Skip to content
OpenFrameworks addon / helpers for working with Google Ceres solver
C++ C Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


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:

  1. ceres doesn't play nice with swizzle and some of the other features of glm, therefore I suggest that you set GLM_FORCE_UNRESTRICTED_GENTYPE project-wide. ofxCeres.props already includes this define.
  2. Some of the maths functions of glm aren't working well. You can find some replacement functions in the ofxCeres::VectorMath namespace which should work as expected. Check [] for notes on why this is.
You can’t perform that action at this time.