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

#include <ceres_nonlinear.hpp>

Public Member Functions

 VertexColorCost (const eos::morphablemodel::PcaModel &shape_model, const eos::morphablemodel::Blendshapes &blendshapes, const eos::morphablemodel::PcaModel &color_model, int num_shape_coeffs, int num_blendshape_coeffs, int num_color_coeffs, int vertex_id, const eos::core::Image3u &image)
 
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, const T *const color_coeffs, T *residual) const
 

Static Public Member Functions

template<int num_shape_coeffs, int num_blendshape_coeffs, int num_color_coeffs>
static ceres::CostFunction * Create (const eos::morphablemodel::PcaModel &shape_model, const eos::morphablemodel::Blendshapes &blendshapes, const eos::morphablemodel::PcaModel &color_model, int vertex_id, const eos::core::Image3u &image)
 

Detailed Description

Image error cost function (at vertex locations).

Measures the RGB image error between a particular vertex point of the 3D model at its projected location and the observed input image. Models the cost for 1 vertex. The residual is 3-dim, [r, g, b]. Its input params are cam, shape-coeffs, BS-coeffs and colour coeffs. This projects the vertex locations - so not a full rendering pass.

Constructor & Destructor Documentation

◆ VertexColorCost()

eos::fitting::VertexColorCost::VertexColorCost ( const eos::morphablemodel::PcaModel shape_model,
const eos::morphablemodel::Blendshapes blendshapes,
const eos::morphablemodel::PcaModel color_model,
int  num_shape_coeffs,
int  num_blendshape_coeffs,
int  num_color_coeffs,
int  vertex_id,
const eos::core::Image3u image 
)
inline

Constructs a new cost function object for a particular vertex id that measures the RGB image error between the estimated model point and the observed input image.

Warning: Don't put in temporaries for shape_model, blendshapes and color_model. 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]color_modelA PCA 3D color model. 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]num_color_coeffsNumber of colour coefficients that are being optimised for.
[in]vertex_idVertex id of the 3D model that should be projected and measured.
[in]imageThe observed image.

Member Function Documentation

◆ Create()

template<int num_shape_coeffs, int num_blendshape_coeffs, int num_color_coeffs>
static ceres::CostFunction * eos::fitting::VertexColorCost::Create ( const eos::morphablemodel::PcaModel shape_model,
const eos::morphablemodel::Blendshapes blendshapes,
const eos::morphablemodel::PcaModel color_model,
int  vertex_id,
const eos::core::Image3u 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.

◆ operator()()

template<typename T >
bool eos::fitting::VertexColorCost::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,
const T *const  color_coeffs,
T *  residual 
) const
inline

Image cost function implementation.

Measures the image pixel error between the given model vertex projected to 2D and the observed input image.

Todo: We should deal with visibility! Don't evaluate when the vertex is self-occluded.

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]color_coeffsA set of PCA colour (albedo) 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: