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
6d72b465
Commit
6d72b465
authored
Dec 15, 2016
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added demo.py script
parent
5a2f8db2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
0 deletions
+41
-0
python/CMakeLists.txt
python/CMakeLists.txt
+2
-0
python/demo.py
python/demo.py
+39
-0
No files found.
python/CMakeLists.txt
View file @
6d72b465
...
@@ -37,4 +37,6 @@ endif()
...
@@ -37,4 +37,6 @@ endif()
pybind11_add_module
(
python-bindings generate-python-bindings.cpp pybind11_glm.hpp
)
pybind11_add_module
(
python-bindings generate-python-bindings.cpp pybind11_glm.hpp
)
target_link_libraries
(
python-bindings PRIVATE
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
target_link_libraries
(
python-bindings PRIVATE
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
set_target_properties
(
python-bindings PROPERTIES OUTPUT_NAME eos
)
set_target_properties
(
python-bindings PROPERTIES OUTPUT_NAME eos
)
install
(
TARGETS python-bindings DESTINATION python
)
install
(
TARGETS python-bindings DESTINATION python
)
install
(
FILES
${
CMAKE_SOURCE_DIR
}
/python/demo.py DESTINATION python
)
python/demo.py
0 → 100644
View file @
6d72b465
import
eos
import
numpy
as
np
def
main
():
"""Demo for running the eos fitting from Python."""
landmarks
=
read_pts
(
'../bin/data/image_0010.pts'
)
landmark_ids
=
list
(
map
(
str
,
range
(
1
,
69
)))
# generates the numbers 1 to 68, as strings
image_width
=
1280
# Make sure to adjust these when using your own images!
image_height
=
1024
model
=
eos
.
morphablemodel
.
load_model
(
"../share/sfm_shape_3448.bin"
)
blendshapes
=
eos
.
morphablemodel
.
load_blendshapes
(
"../share/expression_blendshapes_3448.bin"
)
landmark_mapper
=
eos
.
core
.
LandmarkMapper
(
'../share/ibug2did.txt'
)
edge_topology
=
eos
.
morphablemodel
.
load_edge_topology
(
'../share/sfm_3448_edge_topology.json'
)
contour_landmarks
=
eos
.
fitting
.
ContourLandmarks
.
load
(
'../share/ibug2did.txt'
)
model_contour
=
eos
.
fitting
.
ModelContour
.
load
(
'../share/model_contours.json'
)
(
mesh
,
pose
,
shape_coeffs
,
blendshape_coeffs
)
=
eos
.
fitting
.
fit_shape_and_pose
(
model
,
blendshapes
,
landmarks
,
landmark_ids
,
landmark_mapper
,
image_width
,
image_height
,
edge_topology
,
contour_landmarks
,
model_contour
)
# Now you can use your favourite plotting/rendering library to display the fitted mesh, using the rendering
# parameters in the 'pose' variable.
def
read_pts
(
filename
):
"""A helper function to read ibug .pts landmarks from a file."""
lines
=
open
(
filename
).
read
().
splitlines
()
lines
=
lines
[
3
:
71
]
landmarks
=
[]
for
l
in
lines
:
coords
=
l
.
split
()
landmarks
.
append
([
float
(
coords
[
0
]),
float
(
coords
[
1
])])
return
landmarks
if
__name__
==
"__main__"
:
main
()
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