Represents a mapping from one kind of landmarks to a different format (e.g. model vertices).
More...
#include <LandmarkMapper.hpp>
|
| 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.
|
|
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:
- Mapping 2D landmark points to 3D vertices
- Converting one set of 2D landmarks into another set of 2D landmarks with different identifiers.
◆ 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] | filename | A file with landmark mappings. |
- Exceptions
-
runtime_error | or 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] | mappings | A set of landmark mappings. |
◆ 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_name | A 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: