eos
0.7.1
|
Functionality to represent a Morphable Model, containing it's PCA models and loading functions. More...
Classes | |
struct | Blendshape |
A class representing a 3D blendshape. More... | |
class | MorphableModel |
A class representing a 3D Morphable Model, consisting of a shape- and colour (albedo) PCA model. More... | |
class | PcaModel |
This class represents a PCA-model that consists of: More... | |
Functions | |
std::vector< Blendshape > | load_blendshapes (std::string filename) |
void | save_coefficients (std::vector< float > coefficients, std::string filename) |
std::vector< cv::Vec2f > | load_isomap (boost::filesystem::path isomap_file) |
MorphableModel | load_scm_model (boost::filesystem::path model_filename, boost::filesystem::path isomap_file=boost::filesystem::path()) |
MorphableModel | load_model (std::string filename) |
void | save_model (MorphableModel model, std::string filename) |
cv::Mat | normalise_pca_basis (cv::Mat unnormalised_basis, cv::Mat eigenvalues) |
cv::Mat | unnormalise_pca_basis (cv::Mat normalised_basis, cv::Mat eigenvalues) |
Functionality to represent a Morphable Model, containing it's PCA models and loading functions.
std::vector<Blendshape> eos::morphablemodel::load_blendshapes | ( | std::string | filename | ) |
Helper method to load a file with blendshapes from a cereal::BinaryInputArchive from the harddisk.
[in] | filename | Filename to a blendshapes-file. |
std::runtime_error | When the file given in filename fails to be opened (most likely because the file doesn't exist). |
std::vector< cv::Vec2f > eos::morphablemodel::load_isomap | ( | boost::filesystem::path | isomapFile | ) |
Load a set of 2D texture coordinates pre-generated by the isomap algorithm. After loading, we rescale the coordinates to [0, 1] x [0, 1].
[in] | isomapFile | Path to an isomap file containing texture coordinates. |
... |
MorphableModel eos::morphablemodel::load_model | ( | std::string | filename | ) |
Helper method to load a Morphable Model from a cereal::BinaryInputArchive from the harddisk.
[in] | filename | Filename to a model. |
std::runtime_error | When the file given in filename fails to be opened (most likely because the file doesn't exist). |
MorphableModel eos::morphablemodel::load_scm_model | ( | boost::filesystem::path | model_filename, |
boost::filesystem::path | isomap_file = boost::filesystem::path() |
||
) |
Load a shape or color model from a .scm file containing a Morphable Model in the Surrey format. CVSSP's software internally trains and stores the model in this custom binary format and this class provides means to load them.
Note on multi-resolution models: The landmarks to vertex-id mapping is always the same. The lowest resolution model has all the landmarks defined and for the higher resolutions, the mesh is divided from that on. Note: For new landmarks we add, this might not be the case if we add them in the highest resolution model, so take care!
[in] | model_filename | A binary .scm-file containing the model. |
[in] | isomap_file | An optional path to an isomap containing texture coordinates. |
... |
|
inline |
Takes an unnormalised PCA basis matrix (a matrix consisting of the eigenvectors and normalises it, i.e. multiplies each eigenvector by the square root of its corresponding eigenvalue.
[in] | unnormalised_basis | An unnormalised PCA basis matrix. |
[in] | eigenvalues | A row or column vector of eigenvalues. |
void eos::morphablemodel::save_coefficients | ( | std::vector< float > | coefficients, |
std::string | filename | ||
) |
Saves coefficients (for example PCA shape coefficients) to a json file.
[in] | coefficients | A vector of coefficients. |
[in] | filename | The file to write. |
std::runtime_error | if unable to open the given file for writing. |
void eos::morphablemodel::save_model | ( | MorphableModel | model, |
std::string | filename | ||
) |
Helper method to save a Morphable Model to the harddrive as cereal::BinaryInputArchive.
[in] | model | The model to be saved. |
[in] | filename | Filename for the model. |
|
inline |
Takes a normalised PCA basis matrix (a matrix consisting of the eigenvectors and denormalises it, i.e. multiplies each eigenvector by 1 over the square root of its corresponding eigenvalue.
[in] | normalised_basis | A normalised PCA basis matrix. |
[in] | eigenvalues | A row or column vector of eigenvalues. |