Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
eos
Commits
cdd502ea
Commit
cdd502ea
authored
Mar 04, 2017
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename the bases in io/cvssp.hpp
parent
0fdd8a12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
12 deletions
+12
-12
include/eos/morphablemodel/io/cvssp.hpp
include/eos/morphablemodel/io/cvssp.hpp
+12
-12
No files found.
include/eos/morphablemodel/io/cvssp.hpp
View file @
cdd502ea
...
...
@@ -106,13 +106,13 @@ inline MorphableModel load_scm_model(boost::filesystem::path model_filename, boo
}
// Read shape projection matrix
Mat
unnormalisedPcaBasisS
hape
(
numShapeDims
,
numShapePcaCoeffs
,
CV_32FC1
);
// m x n (rows x cols) = numShapeDims x numShapePcaCoeffs
std
::
cout
<<
"Loading shape PCA basis matrix with "
<<
unnormalisedPcaBasisShape
.
rows
<<
" rows and "
<<
unnormalisedPcaBasisS
hape
.
cols
<<
" cols."
<<
std
::
endl
;
Mat
orthonormal_pca_basis_s
hape
(
numShapeDims
,
numShapePcaCoeffs
,
CV_32FC1
);
// m x n (rows x cols) = numShapeDims x numShapePcaCoeffs
std
::
cout
<<
"Loading shape PCA basis matrix with "
<<
orthonormal_pca_basis_shape
.
rows
<<
" rows and "
<<
orthonormal_pca_basis_s
hape
.
cols
<<
" cols."
<<
std
::
endl
;
for
(
unsigned
int
col
=
0
;
col
<
numShapePcaCoeffs
;
++
col
)
{
for
(
unsigned
int
row
=
0
;
row
<
numShapeDims
;
++
row
)
{
double
var
=
0.0
;
modelFile
.
read
(
reinterpret_cast
<
char
*>
(
&
var
),
8
);
unnormalisedPcaBasisS
hape
.
at
<
float
>
(
row
,
col
)
=
static_cast
<
float
>
(
var
);
orthonormal_pca_basis_s
hape
.
at
<
float
>
(
row
,
col
)
=
static_cast
<
float
>
(
var
);
}
}
...
...
@@ -154,11 +154,11 @@ inline MorphableModel load_scm_model(boost::filesystem::path model_filename, boo
// We read the unnormalised basis from the file. Now let's normalise it and store the normalised basis separately.
// Todo: We should change these to read into an Eigen matrix directly, and not into a cv::Mat first.
using
RowMajorMatrixXf
=
Eigen
::
Matrix
<
float
,
Eigen
::
Dynamic
,
Eigen
::
Dynamic
,
Eigen
::
RowMajor
>
;
Eigen
::
Map
<
RowMajorMatrixXf
>
unnormalisedPcaBasisShape_
(
unnormalisedPcaBasisShape
.
ptr
<
float
>
(),
unnormalisedPcaBasisShape
.
rows
,
unnormalisedPcaBasisS
hape
.
cols
);
Eigen
::
Map
<
RowMajorMatrixXf
>
orthonormal_pca_basis_shape_
(
orthonormal_pca_basis_shape
.
ptr
<
float
>
(),
orthonormal_pca_basis_shape
.
rows
,
orthonormal_pca_basis_s
hape
.
cols
);
Eigen
::
Map
<
RowMajorMatrixXf
>
eigenvaluesShape_
(
eigenvaluesShape
.
ptr
<
float
>
(),
eigenvaluesShape
.
rows
,
eigenvaluesShape
.
cols
);
Eigen
::
Map
<
RowMajorMatrixXf
>
meanShape_
(
meanShape
.
ptr
<
float
>
(),
meanShape
.
rows
,
meanShape
.
cols
);
Eigen
::
MatrixXf
normalisedPcaBasisShape_
=
rescale_pca_basis
(
unnormalisedPcaBasisS
hape_
,
eigenvaluesShape_
);
PcaModel
shapeModel
(
meanShape_
,
normalisedPcaBasisS
hape_
,
eigenvaluesShape_
,
triangleList
);
Eigen
::
MatrixXf
rescaled_pca_basis_shape_
=
rescale_pca_basis
(
orthonormal_pca_basis_s
hape_
,
eigenvaluesShape_
);
PcaModel
shapeModel
(
meanShape_
,
rescaled_pca_basis_s
hape_
,
eigenvaluesShape_
,
triangleList
);
// Reading the color model
// Read number of rows and columns of projection matrix
...
...
@@ -167,13 +167,13 @@ inline MorphableModel load_scm_model(boost::filesystem::path model_filename, boo
modelFile
.
read
(
reinterpret_cast
<
char
*>
(
&
numTexturePcaCoeffs
),
4
);
modelFile
.
read
(
reinterpret_cast
<
char
*>
(
&
numTextureDims
),
4
);
// Read color projection matrix
Mat
unnormalisedPcaBasisC
olor
(
numTextureDims
,
numTexturePcaCoeffs
,
CV_32FC1
);
std
::
cout
<<
"Loading color PCA basis matrix with "
<<
unnormalisedPcaBasisColor
.
rows
<<
" rows and "
<<
unnormalisedPcaBasisC
olor
.
cols
<<
" cols."
<<
std
::
endl
;
Mat
orthonormal_pca_basis_c
olor
(
numTextureDims
,
numTexturePcaCoeffs
,
CV_32FC1
);
std
::
cout
<<
"Loading color PCA basis matrix with "
<<
orthonormal_pca_basis_color
.
rows
<<
" rows and "
<<
orthonormal_pca_basis_c
olor
.
cols
<<
" cols."
<<
std
::
endl
;
for
(
unsigned
int
col
=
0
;
col
<
numTexturePcaCoeffs
;
++
col
)
{
for
(
unsigned
int
row
=
0
;
row
<
numTextureDims
;
++
row
)
{
double
var
=
0.0
;
modelFile
.
read
(
reinterpret_cast
<
char
*>
(
&
var
),
8
);
unnormalisedPcaBasisC
olor
.
at
<
float
>
(
row
,
col
)
=
static_cast
<
float
>
(
var
);
orthonormal_pca_basis_c
olor
.
at
<
float
>
(
row
,
col
)
=
static_cast
<
float
>
(
var
);
}
}
...
...
@@ -206,11 +206,11 @@ inline MorphableModel load_scm_model(boost::filesystem::path model_filename, boo
}
// We read the unnormalised basis from the file. Now let's normalise it and store the normalised basis separately.
Eigen
::
Map
<
RowMajorMatrixXf
>
unnormalisedPcaBasisColor_
(
unnormalisedPcaBasisColor
.
ptr
<
float
>
(),
unnormalisedPcaBasisColor
.
rows
,
unnormalisedPcaBasisC
olor
.
cols
);
Eigen
::
Map
<
RowMajorMatrixXf
>
orthonormal_pca_basis_color_
(
orthonormal_pca_basis_color
.
ptr
<
float
>
(),
orthonormal_pca_basis_color
.
rows
,
orthonormal_pca_basis_c
olor
.
cols
);
Eigen
::
Map
<
RowMajorMatrixXf
>
eigenvaluesColor_
(
eigenvaluesColor
.
ptr
<
float
>
(),
eigenvaluesColor
.
rows
,
eigenvaluesColor
.
cols
);
Eigen
::
Map
<
RowMajorMatrixXf
>
meanColor_
(
meanColor
.
ptr
<
float
>
(),
meanColor
.
rows
,
meanColor
.
cols
);
Eigen
::
MatrixXf
normalisedPcaBasisColor_
=
rescale_pca_basis
(
unnormalisedPcaBasisC
olor_
,
eigenvaluesColor_
);
PcaModel
colorModel
(
meanColor_
,
normalisedPcaBasisC
olor_
,
eigenvaluesColor_
,
triangleList
);
Eigen
::
MatrixXf
rescaled_pca_basis_color_
=
rescale_pca_basis
(
orthonormal_pca_basis_c
olor_
,
eigenvaluesColor_
);
PcaModel
colorModel
(
meanColor_
,
rescaled_pca_basis_c
olor_
,
eigenvaluesColor_
,
triangleList
);
modelFile
.
close
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment