Carotid 0.1.1
Loading...
Searching...
No Matches
IdentityGenerator.h
Go to the documentation of this file.
1#ifndef CAROTID_IDENTITYGENERATOR_H
2#define CAROTID_IDENTITYGENERATOR_H
3
4#include "Utility.h"
5
6namespace carotid {
7
8constexpr uint32_t CAROTID_SPATIAL_DIMENSIONS = 3;
9
10constexpr uint32_t CAROTID_VERTEX_COUNT_LVL1 = 12466;
11constexpr uint32_t CAROTID_VERTEX_COUNT_LVL2 = 49751;
12constexpr uint32_t CAROTID_VERTEX_COUNT_LVL3 = 198781;
13
15class IdOptions {
16
17public:
19 uint32_t vertexCount;
20
22 uint32_t dim;
23
24public:
25 explicit IdOptions(const uint32_t dim)
27};
28
32
33public:
37
41
45
46public:
47 [[nodiscard]] explicit IdentityGenerator(const IdOptions opts) : opts(opts) {}
48
51 inline uint32_t getNumRows() const {
53 }
54
57 inline uint32_t getNumCols() const { return opts.dim; }
58
61 inline std::pair<uint32_t, uint32_t> getSize() const {
62 return {getNumRows(), getNumCols()};
63 }
64
69 void loadModelFromBinary(const Path &avgModelPath, const Path &eigenvecsPath,
70 const Path &eigenvalsPath);
71
74 [[nodiscard]] bool validateModel() const;
75
78 [[nodiscard]] Vec<float> generateBaseModel() const;
79
83 [[nodiscard]] Vec<float> generateModel(const Vec<float> &eigenvals) const;
84
85private:
86 Vec<float> avgModel;
87 Mat<float> eigenvecs;
88 Vec<float> eigenvals;
89};
90
91} // namespace carotid
92
93#endif // CAROTID_IDENTITYGENERATOR_H
IdOptions - Options for the IdentityGenerator class.
Definition IdentityGenerator.h:15
uint32_t dim
Number of PCA dimensions to use.
Definition IdentityGenerator.h:22
uint32_t vertexCount
Number of points in the model.
Definition IdentityGenerator.h:19
IdOptions(const uint32_t dim)
Definition IdentityGenerator.h:25
IdentityGenerator - A class for generating shape blendshapes.
Definition IdentityGenerator.h:31
void loadModelFromBinary(const Path &avgModelPath, const Path &eigenvecsPath, const Path &eigenvalsPath)
Load the model from binary files.
Definition IdentityGenerator.cpp:10
Vec< float > generateBaseModel() const
Generate the base model.
Definition IdentityGenerator.cpp:44
Vec< float > cur_params
Definition IdentityGenerator.h:44
Vec< float > cur_model
Definition IdentityGenerator.h:40
std::pair< uint32_t, uint32_t > getSize() const
Get the size of the eigenvector matrix.
Definition IdentityGenerator.h:61
Vec< float > generateModel(const Vec< float > &eigenvals) const
Generate the model with the given eigenvalues.
Definition IdentityGenerator.cpp:48
bool validateModel() const
Validate the model.
Definition IdentityGenerator.cpp:38
IdOptions opts
Definition IdentityGenerator.h:36
uint32_t getNumCols() const
Get the number of columns in the egienvector matrix.
Definition IdentityGenerator.h:57
uint32_t getNumRows() const
Get the number of rows in the egienvector matrix.
Definition IdentityGenerator.h:51
IdentityGenerator(const IdOptions opts)
Definition IdentityGenerator.h:47
Definition IdentityGenerator.h:6
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vec
Definition Utility.h:17
constexpr uint32_t CAROTID_SPATIAL_DIMENSIONS
Definition IdentityGenerator.h:8
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Mat
Definition Utility.h:14
constexpr uint32_t CAROTID_VERTEX_COUNT_LVL3
Definition IdentityGenerator.h:12
constexpr uint32_t CAROTID_VERTEX_COUNT_LVL2
Definition IdentityGenerator.h:11
std::filesystem::path Path
Definition Utility.h:11
constexpr uint32_t CAROTID_VERTEX_COUNT_LVL1
Definition IdentityGenerator.h:10