eos  0.7.1
Public Member Functions | Friends | List of all members
eos::morphablemodel::MorphableModel Class Reference

A class representing a 3D Morphable Model, consisting of a shape- and colour (albedo) PCA model. More...

#include <MorphableModel.hpp>

Public Member Functions

 MorphableModel (PcaModel shape_model, PcaModel color_model, std::vector< cv::Vec2f > texture_coordinates=std::vector< cv::Vec2f >())
 
PcaModel get_shape_model () const
 
PcaModel get_color_model () const
 
render::Mesh get_mean () const
 
render::Mesh draw_sample (float shape_sigma=1.0f, float color_sigma=1.0f)
 
render::Mesh draw_sample (std::vector< float > shape_coefficients, std::vector< float > color_coefficients) const
 
bool has_color_model () const
 
std::vector< cv::Vec2f > get_texture_coordinates () const
 

Friends

class cereal::access
 

Detailed Description

A class representing a 3D Morphable Model, consisting of a shape- and colour (albedo) PCA model.

For the general idea of 3DMMs see T. Vetter, V. Blanz, 'A Morphable Model for the Synthesis of 3D Faces', SIGGRAPH 1999.

Constructor & Destructor Documentation

eos::morphablemodel::MorphableModel::MorphableModel ( PcaModel  shape_model,
PcaModel  color_model,
std::vector< cv::Vec2f >  texture_coordinates = std::vector<cv::Vec2f>() 
)
inline

Create a Morphable Model from a shape and a color PCA model, and optional texture coordinates.

Parameters
[in]shape_modelA PCA model over the shape.
[in]color_modelA PCA model over the colour (albedo).
[in]texture_coordinatesOptional texture coordinates for every vertex.

Member Function Documentation

render::Mesh eos::morphablemodel::MorphableModel::draw_sample ( float  shape_sigma = 1.0f,
float  color_sigma = 1.0f 
)
inline

Draws a random sample from the model, where the coefficients for the shape- and color models are both drawn from a standard normal (or with the given standard deviation).

Parameters
[in]shape_sigmaThe shape model standard deviation.
[in]color_sigmaThe color model standard deviation.
Returns
A random sample from the model.
render::Mesh eos::morphablemodel::MorphableModel::draw_sample ( std::vector< float >  shape_coefficients,
std::vector< float >  color_coefficients 
) const
inline

Returns a sample from the model with the given shape- and colour PCA coefficients.

If one of the given vectors is empty, the mean is used. The coefficient vectors should contain normalised, i.e. standard normal distributed coefficients. If the Morphable Model is a shape-only model (without colour model), make sure to leave color_coefficients empty. If a partial coefficient vector is given, it is filled with zeros up to the end.

Parameters
[in]shape_coefficientsThe PCA coefficients used to generate the shape sample.
[in]color_coefficientsThe PCA coefficients used to generate the vertex colouring.
Returns
A model instance with given coefficients.
PcaModel eos::morphablemodel::MorphableModel::get_color_model ( ) const
inline

Returns the PCA color (albedo) model of this Morphable Model.

Returns
The color model.
render::Mesh eos::morphablemodel::MorphableModel::get_mean ( ) const
inline

Returns the mean of the shape- and color model as a Mesh.

Returns
An mesh instance of the mean of the Morphable Model.
PcaModel eos::morphablemodel::MorphableModel::get_shape_model ( ) const
inline

Returns the PCA shape model of this Morphable Model. as a Mesh.

Returns
The shape model.
std::vector<cv::Vec2f> eos::morphablemodel::MorphableModel::get_texture_coordinates ( ) const
inline

Returns the texture coordinates for all the vertices in the model.

Returns
The texture coordinates for the model vertices.
bool eos::morphablemodel::MorphableModel::has_color_model ( ) const
inline

Returns true if this Morphable Model contains a colour model. Returns false if it is a shape-only model.

Returns
True if the Morphable Model has a colour model (i.e. is not a shape-only model).

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