patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

Re-add contour fitting to fit-model-ceres #349

Closed patrikhuber closed 1 year ago

patrikhuber commented 1 year ago

The contour fitting is commented out at the moment in fit-model-ceres. It needs extracting the yaw angle from the rotation quaternion, which Eigen currently doesn't have a function for. It could be re-added easily, we just need a reliable way to convert from the estimated rotation quaternion to a yaw angle.

patrikhuber commented 1 year ago

Ceres added ceres::RotationMatrixToEulerAngles(), but only post-2.1. It would go something like this:

    Eigen::Matrix3d rot_mtx_ceres;
    Eigen::Vector3d euler_angles_ceres;
    ceres::QuaternionToRotation(camera_rotation.coeffs().data(), rot_mtx_ceres.data());
    ceres::RotationMatrixToEulerAngles<ceres::IntrinsicZYX>(rot_mtx_ceres.data(), euler_angles_ceres.data());

But it's probably better to use Eigen's Euler angles functionality everywhere.

patrikhuber commented 1 year ago

Done in b74f499c25fced14ea6efe11a5551e28f5112a9d, and released in v.1.4.0.