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
d5fcd7ae
Commit
d5fcd7ae
authored
Jan 30, 2017
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move incrementing the vertex indices for Matlab into the converter function
parent
7ecd2e60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
11 deletions
+19
-11
matlab/+eos/+fitting/private/fitting.cpp
matlab/+eos/+fitting/private/fitting.cpp
+0
-8
matlab/include/mexplus_eos_types.hpp
matlab/include/mexplus_eos_types.hpp
+19
-3
No files found.
matlab/+eos/+fitting/private/fitting.cpp
View file @
d5fcd7ae
...
@@ -92,14 +92,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
...
@@ -92,14 +92,6 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
fitting
::
RenderingParameters
rendering_parameters
;
fitting
::
RenderingParameters
rendering_parameters
;
std
::
tie
(
mesh
,
rendering_parameters
)
=
fitting
::
fit_shape_and_pose
(
morphable_model
,
blendshapes
,
landmarks
,
landmark_mapper
,
image_width
,
image_height
,
edge_topology
,
contour_landmarks
,
model_contour
,
num_iterations
,
num_shape_coefficients_to_fit
,
lambda
);
std
::
tie
(
mesh
,
rendering_parameters
)
=
fitting
::
fit_shape_and_pose
(
morphable_model
,
blendshapes
,
landmarks
,
landmark_mapper
,
image_width
,
image_height
,
edge_topology
,
contour_landmarks
,
model_contour
,
num_iterations
,
num_shape_coefficients_to_fit
,
lambda
);
// C++ counts the vertex indices starting at zero, Matlab starts counting
// at one - therefore, add +1 to all triangle indices:
for
(
auto
&&
t
:
mesh
.
tvi
)
{
for
(
auto
&&
idx
:
t
)
{
idx
+=
1
;
}
}
// Return the mesh and the rendering_parameters:
// Return the mesh and the rendering_parameters:
OutputArguments
output
(
nlhs
,
plhs
,
2
);
OutputArguments
output
(
nlhs
,
plhs
,
2
);
output
.
set
(
0
,
mesh
);
output
.
set
(
0
,
mesh
);
...
...
matlab/include/mexplus_eos_types.hpp
View file @
d5fcd7ae
...
@@ -199,14 +199,30 @@ mxArray* MxArray::from(const std::vector<std::array<int, 3>>& data)
...
@@ -199,14 +199,30 @@ mxArray* MxArray::from(const std::vector<std::array<int, 3>>& data)
* @return An mxArray containing a Matlab struct with all vertex, colour, texcoords and triangle data.
* @return An mxArray containing a Matlab struct with all vertex, colour, texcoords and triangle data.
*/
*/
template
<
>
template
<
>
mxArray
*
MxArray
::
from
(
const
eos
::
core
::
Mesh
&
mesh
)
{
mxArray
*
MxArray
::
from
(
const
eos
::
core
::
Mesh
&
mesh
)
{
// C++ counts the vertex indices starting at zero, Matlab starts counting
// at one - therefore, add +1 to all triangle indices:
auto
tvi_1based
=
mesh
.
tvi
;
for
(
auto
&&
t
:
tvi_1based
)
{
for
(
auto
&&
idx
:
t
)
{
idx
+=
1
;
}
}
// Same for tci:
auto
tci_1based
=
mesh
.
tci
;
for
(
auto
&&
t
:
tci_1based
)
{
for
(
auto
&&
idx
:
t
)
{
idx
+=
1
;
}
}
MxArray
out_array
(
MxArray
::
Struct
());
MxArray
out_array
(
MxArray
::
Struct
());
out_array
.
set
(
"vertices"
,
mesh
.
vertices
);
out_array
.
set
(
"vertices"
,
mesh
.
vertices
);
out_array
.
set
(
"colors"
,
mesh
.
colors
);
out_array
.
set
(
"colors"
,
mesh
.
colors
);
out_array
.
set
(
"texcoords"
,
mesh
.
texcoords
);
out_array
.
set
(
"texcoords"
,
mesh
.
texcoords
);
out_array
.
set
(
"tvi"
,
mesh
.
tvi
);
out_array
.
set
(
"tvi"
,
tvi_1based
);
out_array
.
set
(
"tci"
,
mesh
.
tci
);
out_array
.
set
(
"tci"
,
tci_1based
);
return
out_array
.
release
();
return
out_array
.
release
();
};
};
...
...
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