Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
py-3d-face-reconstruction
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
py-3d-face-reconstruction
Commits
347a71c3
Commit
347a71c3
authored
Aug 01, 2016
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved imm_points to imm, in preperation of including a dataset implementation capability
parent
f495975f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
13 deletions
+24
-13
src/aam.py
src/aam.py
+13
-9
src/aam_test.py
src/aam_test.py
+1
-1
src/imm.py
src/imm.py
+0
-0
src/imm_test.py
src/imm_test.py
+0
-0
src/main.py
src/main.py
+9
-2
src/view/reconstruct.py
src/view/reconstruct.py
+1
-1
No files found.
src/aam.py
View file @
347a71c3
...
...
@@ -51,7 +51,7 @@ class AAMPoints():
return
self
.
bounding_box
def
get_scaled_points
(
self
,
shape
,
rescale
=
False
):
def
get_scaled_points
(
self
,
width_height_dimensions
,
rescale
=
False
):
"""
Scale the normalized flattened points list to a scale given by 'shape'.
The x and y values should be scaled to the width and height of the image.
...
...
@@ -66,11 +66,14 @@ class AAMPoints():
if
self
.
points_list
is
None
or
rescale
:
self
.
points_list
=
self
.
normalized_flattened_points_list
# shape into [[x, y(, z)], [x, y, (,z)]]
# we use the 'actual_shape' which is known from the creation of
# this object.
if
len
(
self
.
actual_shape
):
self
.
points_list
=
self
.
points_list
.
reshape
(
self
.
actual_shape
)
h
=
shape
[
0
]
w
=
shape
[
1
]
h
=
width_height_dimensions
[
0
]
w
=
width_height_dimensions
[
1
]
self
.
points_list
[:,
0
]
=
self
.
points_list
[:,
0
]
*
w
self
.
points_list
[:,
1
]
=
self
.
points_list
[:,
1
]
*
h
...
...
@@ -88,11 +91,13 @@ class AAMPoints():
width)
"""
assert
self
.
points_list
is
not
None
,
\
'the list points already need to be scaled order to correctly work'
'the list points already need to be scaled order to correctly work,
\
this requires that get_scaled_points is executed first.'
hull
=
cv2
.
convexHull
(
self
.
points_list
,
returnPoints
=
True
)
return
cv2
.
boundingRect
(
hull
)
# TODO: impove by not using opencv but just min-max of the lists
def
get_bounding_box_2
(
self
):
pass
#hull = cv2.convexHull(self.points_list, returnPoints=True)
...
...
@@ -103,7 +108,7 @@ class AAMPoints():
def
get_mean
(
vector
):
""" construct a mean from a matrix of x,y values
Args:
imm_
points(numpy array) that follows the following structure:
points(numpy array) that follows the following structure:
Returns:
mean_values (numpy array)
...
...
@@ -187,8 +192,8 @@ def build_texture_feature_vectors(files, get_image_with_points, mean_points, tri
"""
Args:
files (list): list files
flattened (bool): Flatten the inner feature vectors, see
flatten_feature_vectors
.
get_image_with_points (function): That can return the image together
with the location
.
mean_points(AAMPoints): AAMPoints object
Returns:
...
...
@@ -197,8 +202,7 @@ def build_texture_feature_vectors(files, get_image_with_points, mean_points, tri
mean_texture
=
[]
image
,
points
=
get_image_with_points
(
files
[
0
])
mean_points
.
get_scaled_points
(
image
.
shape
)
mean_points
.
get_scaled_points
(
image
.
shape
)
# improve this, see issue #1
x
,
y
,
w_slice
,
h_slice
=
mean_points
.
get_bounding_box
()
for
i
,
f
in
enumerate
(
files
):
...
...
src/aam_test.py
View file @
347a71c3
...
...
@@ -4,7 +4,7 @@ import pytest
import
aam
import
pca
import
imm
_points
as
imm
import
imm
from
reconstruction
import
triangles
as
tri
...
...
src/imm
_points
.py
→
src/imm.py
View file @
347a71c3
File moved
src/imm_
points_
test.py
→
src/imm_test.py
View file @
347a71c3
File moved
src/main.py
View file @
347a71c3
...
...
@@ -10,7 +10,7 @@ import cv2
# local imports
import
pca
import
aam
import
imm
_points
as
imm
import
imm
from
reconstruction
import
reconstruction
...
...
@@ -67,6 +67,11 @@ def add_parser_options():
help
=
'pca model file that contains or is going to contain the pca shape model'
)
pca_group
.
add_argument
(
'--shape_type'
,
type
=
str
,
choices
=
[
'imm'
],
help
=
'type of shape, annotated dataset'
)
pca_group
.
add_argument
(
'--model_texture_file'
,
type
=
str
,
help
=
'pca model file that contains or is going to contain the pca texture model'
...
...
@@ -135,7 +140,8 @@ def save_pca_model_shape(args):
assert
args
.
model_shape_file
,
'--model_shape_file needs to be provided to save the pca model'
points
=
aam
.
build_shape_feature_vectors
(
args
.
files
,
imm
.
get_imm_points
,
flattened
=
True
)
args
.
files
,
imm
.
get_imm_points
,
flattened
=
True
)
mean_values
=
aam
.
get_mean
(
points
)
...
...
@@ -213,6 +219,7 @@ def show_pca_model(args):
def
generate_call_graph
(
args
):
"""Performance debug function, will be (re)moved later. """
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'
...
...
src/view/reconstruct.py
View file @
347a71c3
...
...
@@ -19,7 +19,7 @@ from kivy.graphics.context_instructions import Color
from
functools
import
partial
from
math
import
cos
,
sin
,
pi
import
imm
_points
as
imm
import
imm
from
utils
import
utils
from
utils.texture
import
fill_triangle
#import IMMPoints, build_feature_vectors, \
...
...
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