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
9f4ceede
Commit
9f4ceede
authored
Jul 09, 2015
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added scm-to-cereal convert app
parent
7ac1b4a8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
0 deletions
+92
-0
examples/CMakeLists.txt
examples/CMakeLists.txt
+7
-0
examples/scm-to-cereal.cpp
examples/scm-to-cereal.cpp
+85
-0
No files found.
examples/CMakeLists.txt
View file @
9f4ceede
...
...
@@ -13,11 +13,18 @@ else(Boost_FOUND)
message
(
FATAL_ERROR
"Boost not found"
)
endif
()
#include_directories(${eos_SOURCE_DIR})
# Model fitting (affine cam & shape to landmarks) example:
add_executable
(
fit_model fit_model.cpp
)
target_link_libraries
(
fit_model
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
# TODO Add dependency to library-target??
# Converts a CVSSP .scm Morphable Model to a cereal binary file:
add_executable
(
scm-to-cereal scm-to-cereal.cpp
)
target_link_libraries
(
scm-to-cereal
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
# install target:
install
(
TARGETS fit_model DESTINATION bin
)
install
(
TARGETS scm-to-cereal DESTINATION bin
)
install
(
DIRECTORY
${
CMAKE_SOURCE_DIR
}
/examples/data DESTINATION bin
)
examples/scm-to-cereal.cpp
0 → 100644
View file @
9f4ceede
/*
* Eos - A 3D Morphable Model fitting library written in modern C++11/14.
*
* File: examples/scm-to-cereal.cpp
*
* Copyright 2015 Patrik Huber
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "eos/morphablemodel/MorphableModel.hpp"
#include "eos/morphablemodel/io/cvssp.hpp"
#include "opencv2/core/core.hpp"
#ifdef WIN32
#define BOOST_ALL_DYN_LINK // Link against the dynamic boost lib. Seems to be necessary because we use /MD, i.e. link to the dynamic CRT.
#define BOOST_ALL_NO_LIB // Don't use the automatic library linking by boost with VS2010 (#pragma ...). Instead, we specify everything in cmake.
#endif
#include "boost/program_options.hpp"
#include "boost/filesystem.hpp"
#include <vector>
#include <iostream>
#include <fstream>
using
namespace
eos
;
namespace
po
=
boost
::
program_options
;
namespace
fs
=
boost
::
filesystem
;
using
std
::
cout
;
using
std
::
endl
;
/**
* Reads a CVSSP .scm Morphable Model file and converts it
* to a cereal binary file.
*/
int
main
(
int
argc
,
char
*
argv
[])
{
fs
::
path
scmmodelfile
,
isomapfile
,
outputfile
;
try
{
po
::
options_description
desc
(
"Allowed options"
);
desc
.
add_options
()
(
"help,h"
,
"display the help message"
)
(
"model,m"
,
po
::
value
<
fs
::
path
>
(
&
scmmodelfile
)
->
required
(),
"a CVSSP .scm Morphable Model file"
)
(
"isomap,t"
,
po
::
value
<
fs
::
path
>
(
&
isomapfile
),
"optional isomap containing the texture mapping coordinates"
)
(
"output,o"
,
po
::
value
<
fs
::
path
>
(
&
outputfile
)
->
required
()
->
default_value
(
"converted_model.bin"
),
"output filename for the Morphable Model in cereal binary format"
)
;
po
::
variables_map
vm
;
po
::
store
(
po
::
command_line_parser
(
argc
,
argv
).
options
(
desc
).
run
(),
vm
);
if
(
vm
.
count
(
"help"
))
{
cout
<<
"Usage: scm-to-cereal [options]"
<<
endl
;
cout
<<
desc
;
return
EXIT_SUCCESS
;
}
po
::
notify
(
vm
);
}
catch
(
const
po
::
error
&
e
)
{
cout
<<
"Error while parsing command-line arguments: "
<<
e
.
what
()
<<
endl
;
cout
<<
"Use --help to display a list of options."
<<
endl
;
return
EXIT_SUCCESS
;
}
// Load the .scm Morphable Model and save it as cereal model:
morphablemodel
::
MorphableModel
morphable_model
=
morphablemodel
::
loadScmModel
(
scmmodelfile
,
isomapfile
);
morphablemodel
::
save_model
(
morphable_model
,
outputfile
.
string
());
// Save only the shape model - to generate the public sfm_shape_3448.bin
//morphablemodel::MorphableModel shape_only_model(morphable_model.get_shape_model(), morphablemodel::PcaModel(), morphable_model.gtc());
//morphablemodel::save_model(shape_only_model, outputfile.string());
return
EXIT_SUCCESS
;
}
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