eos 1.4.0
|
#include <ceres_nonlinear.hpp>
Public Member Functions | |
PerspectiveProjectionLandmarkCost (const morphablemodel::PcaModel &shape_model, const std::vector< morphablemodel::Blendshape > &blendshapes, int num_shape_coeffs, int num_blendshape_coeffs, Eigen::Vector2f observed_landmark, int vertex_id, int image_width, int image_height) | |
template<typename T > | |
bool | operator() (const T *const camera_rotation, const T *const camera_translation, const T *const camera_intrinsics, const T *const shape_coeffs, const T *const blendshape_coeffs, T *residual) const |
Static Public Member Functions | |
template<int num_shape_coeffs, int num_blendshape_coeffs> | |
static ceres::CostFunction * | Create (const eos::morphablemodel::PcaModel &shape_model, const eos::morphablemodel::Blendshapes &blendshapes, Eigen::Vector2f observed_landmark, int vertex_id, int image_width, int image_height) |
2D landmark error cost function, using perspective projection (in OpenGL convention).
Computes the landmark reprojection error in 2D. Models the cost for one landmark. The residual is 2-dim, [x, y]. Its input params are camera parameters, shape coefficients and blendshape coefficients.
|
inline |
Constructs a new landmark cost function object with for a particular landmark/vertex id.
Warning: Don't put in temporaries for shape_model
and blendshapes!
We don't make a copy, we store a reference to what is given to the function!
[in] | shape_model | A PCA 3D shape model. Do not use a temporary. |
[in] | blendshapes | A set of 3D blendshapes. Do not use a temporary. |
[in] | num_shape_coeffs | Number of shape coefficients that are being optimised for. |
[in] | num_blendshape_coeffs | Number of blendshape coefficients that are being optimised for. |
[in] | observed_landmark | An observed 2D landmark in an image. |
[in] | vertex_id | The vertex id that the given observed landmark corresponds to. |
[in] | image_width | Width of the image that the 2D landmark is from (needed for the model projection). |
[in] | image_height | Height of the image. |
|
inlinestatic |
Factory to hide the construction of the CostFunction object from the client code.
The number of parameters are given as template arguments, so that we can use Ceres' fixed-size constructor.
|
inline |
Landmark cost function implementation.
Measures the landmark reprojection error of the model with the estimated parameters and the observed 2D landmarks. For one single landmark.
[in] | camera_rotation | A set of camera rotation parameters, parameterised as an Eigen::Quaternion. |
[in] | camera_translation | Camera translation parameters: [t_x t_y t_z]. |
[in] | camera_intrinsics | Camera intrinsics, containing the field of view (fov_y). |
[in] | shape_coeffs | A set of PCA shape coefficients. |
[in] | blendshape_coeffs | A set of blendshape coefficients. |
[in] | residual | An array of the resulting residuals. |