eos 1.4.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
eos::core::LandmarkMapper Class Reference

Represents a mapping from one kind of landmarks to a different format (e.g. model vertices). More...

#include <LandmarkMapper.hpp>

Public Member Functions

 LandmarkMapper ()=default
 Constructs a new landmark mapper that performs an identity mapping, that is, its output is the same as the input.
 
 LandmarkMapper (std::string filename)
 Constructs a new landmark mapper from a file containing mappings from one set of landmark identifiers to another.
 
 LandmarkMapper (const std::unordered_map< std::string, std::string > &mappings)
 Constructs a new landmark mapper from a set of existing mappings.
 
cpp17::optional< std::string > convert (std::string landmark_name) const
 Converts the given landmark name to the mapped name.
 
auto num_mappings () const
 Returns the number of loaded landmark mappings.
 
const auto & get_mappings () const
 Returns the mappings held by this mapper.
 

Detailed Description

Represents a mapping from one kind of landmarks to a different format (e.g. model vertices).

When fitting the 3D model to an image, a correspondence must be known from the 2D image landmarks to 3D vertex points in the Morphable Model. The 3D model defines all its points in the form of vertex ids. These mappings are stored in a file, see the share/ folder for an example for mapping 2D ibug landmarks to 3D model vertex indices.

The LandmarkMapper thus has two main use cases:

Constructor & Destructor Documentation

◆ LandmarkMapper() [1/2]

eos::core::LandmarkMapper::LandmarkMapper ( std::string  filename)
inline

Constructs a new landmark mapper from a file containing mappings from one set of landmark identifiers to another.

In case the file contains no mappings, a landmark mapper that performs an identity mapping is constructed.

Parameters
[in]filenameA file with landmark mappings.
Exceptions
runtime_erroror toml::exception if there is an error loading the mappings from the file.

◆ LandmarkMapper() [2/2]

eos::core::LandmarkMapper::LandmarkMapper ( const std::unordered_map< std::string, std::string > &  mappings)
inline

Constructs a new landmark mapper from a set of existing mappings.

Parameters
[in]mappingsA set of landmark mappings.

Member Function Documentation

◆ convert()

cpp17::optional< std::string > eos::core::LandmarkMapper::convert ( std::string  landmark_name) const
inline

Converts the given landmark name to the mapped name.

In the case the mapper is empty (no mappings defined at all), the mapper will perform an identity mapping and return the landmark_name that was input.

Parameters
[in]landmark_nameA landmark name to convert.
Returns
The mapped landmark name if a mapping exists, an empty optional otherwise.

◆ get_mappings()

const auto & eos::core::LandmarkMapper::get_mappings ( ) const
inline

Returns the mappings held by this mapper.

Returns
All mappings contained in the mapper.

◆ num_mappings()

auto eos::core::LandmarkMapper::num_mappings ( ) const
inline

Returns the number of loaded landmark mappings.

Returns
The number of landmark mappings.

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