Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
py-3d-face-reconstruction
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Richard Torenvliet
py-3d-face-reconstruction
Commits
be4ae8da
Commit
be4ae8da
authored
8 years ago
by
Richard Torenvliet
Browse files
Options
Downloads
Patches
Plain Diff
Fixed the code that generated the texture PCA model
parent
31abc3e9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/aam.py
+5
-1
5 additions, 1 deletion
src/aam.py
src/main.py
+18
-7
18 additions, 7 deletions
src/main.py
with
23 additions
and
8 deletions
src/aam.py
+
5
−
1
View file @
be4ae8da
...
...
@@ -195,6 +195,10 @@ def build_texture_feature_vectors(files, get_image_with_points, MeanPoints, tria
list: list of feature vectors
"""
mean_texture
=
[]
image
,
points
=
get_image_with_points
(
files
[
0
])
MeanPoints
.
get_scaled_points
(
image
.
shape
)
x
,
y
,
w_slice
,
h_slice
=
MeanPoints
.
get_bounding_box
()
for
i
,
f
in
enumerate
(
files
):
...
...
@@ -211,7 +215,7 @@ def build_texture_feature_vectors(files, get_image_with_points, MeanPoints, tria
sample_from_triangles
(
image
,
Points
.
get_scaled_points
(
image
.
shape
),
MeanPoints
(
image
.
shape
),
MeanPoints
.
get_scaled_points
(
image
.
shape
),
triangles
,
dst
)
...
...
This diff is collapsed.
Click to expand it.
src/main.py
+
18
−
7
View file @
be4ae8da
...
...
@@ -96,21 +96,32 @@ def save_pca_model_texture(args):
assert
args
.
model_shape_file
,
'
--model_texture_file needs to be provided to save the pca model
'
assert
args
.
model_texture_file
,
'
--model_texture_file needs to be provided to save the pca model
'
Vt
,
s
,
n_components
,
mean_shape
,
triangles
=
pca
.
load
(
args
.
model_shape_file
)
shape_model
=
pca
.
PcaModel
(
args
.
model_shape_file
)
MeanPoints
=
aam
.
AAMPoints
(
normalized_flattened_points_list
=
mean_value_points
,
actual_shape
=
(
58
,
2
)
)
mean_points
=
imm
.
IMMPoints
(
points_list
=
shape_model
.
mean_values
)
#reconstruction.reconstruct_texture(
# input_image, # src image
# input_image, # dst image
# texture_model,
# input_points, # shape points input
# mean_points, # shape points mean
#)
# old
#Vt, s, n_components, mean_shape, triangles = pca.load(args.model_shape_file)
textures
=
aam
.
build_texture_feature_vectors
(
args
.
files
,
imm
.
get_imm_image_with_landmarks
,
MeanPoints
,
triangles
args
.
files
,
imm
.
get_imm_image_with_landmarks
,
mean_points
,
shape_model
.
triangles
)
mean_texture
=
aam
.
get_mean
(
textures
)
_
,
s
,
Vt
,
n_components
=
pca
.
pca
(
textures
,
mean_texture
)
pca
.
save
(
Vt
,
s
,
n_components
,
mean_texture
,
triangles
,
args
.
model_texture_file
)
pca
.
save
(
Vt
,
s
,
n_components
,
mean_texture
,
shape_model
.
triangles
,
args
.
model_texture_file
)
logger
.
info
(
'
texture pca model saved in %s
'
,
args
.
model_texture_file
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment