eos 1.4.0
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
eos::fitting::PerspectiveProjectionLandmarkCost Struct Reference

#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)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ PerspectiveProjectionLandmarkCost()

eos::fitting::PerspectiveProjectionLandmarkCost::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 
)
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!

Parameters
[in]shape_modelA PCA 3D shape model. Do not use a temporary.
[in]blendshapesA set of 3D blendshapes. Do not use a temporary.
[in]num_shape_coeffsNumber of shape coefficients that are being optimised for.
[in]num_blendshape_coeffsNumber of blendshape coefficients that are being optimised for.
[in]observed_landmarkAn observed 2D landmark in an image.
[in]vertex_idThe vertex id that the given observed landmark corresponds to.
[in]image_widthWidth of the image that the 2D landmark is from (needed for the model projection).
[in]image_heightHeight of the image.

Member Function Documentation

◆ Create()

template<int num_shape_coeffs, int num_blendshape_coeffs>
static ceres::CostFunction * eos::fitting::PerspectiveProjectionLandmarkCost::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 
)
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.

◆ operator()()

template<typename T >
bool eos::fitting::PerspectiveProjectionLandmarkCost::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
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.

Parameters
[in]camera_rotationA set of camera rotation parameters, parameterised as an Eigen::Quaternion.
[in]camera_translationCamera translation parameters: [t_x t_y t_z].
[in]camera_intrinsicsCamera intrinsics, containing the field of view (fov_y).
[in]shape_coeffsA set of PCA shape coefficients.
[in]blendshape_coeffsA set of blendshape coefficients.
[in]residualAn array of the resulting residuals.
Returns
whether the computation of the residuals was successful. Always returns true.

The documentation for this struct was generated from the following file: