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
136ae7cc
Commit
136ae7cc
authored
Jan 15, 2016
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a function to save coefficients as json file
parent
a2092e25
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
CMakeLists.txt
CMakeLists.txt
+1
-0
include/eos/morphablemodel/coefficients.hpp
include/eos/morphablemodel/coefficients.hpp
+54
-0
No files found.
CMakeLists.txt
View file @
136ae7cc
...
...
@@ -93,6 +93,7 @@ set(HEADERS
include/eos/morphablemodel/PcaModel.hpp
include/eos/morphablemodel/MorphableModel.hpp
include/eos/morphablemodel/Blendshape.hpp
include/eos/morphablemodel/coefficients.hpp
include/eos/morphablemodel/io/cvssp.hpp
include/eos/morphablemodel/io/mat_cerealisation.hpp
include/eos/fitting/affine_camera_estimation.hpp
...
...
include/eos/morphablemodel/coefficients.hpp
0 → 100644
View file @
136ae7cc
/*
* Eos - A 3D Morphable Model fitting library written in modern C++11/14.
*
* File: include/eos/morphablemodel/coefficients.hpp
*
* Copyright 2016 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.
*/
#pragma once
#ifndef COEFFICIENTS_HPP_
#define COEFFICIENTS_HPP_
#include "cereal/cereal.hpp"
#include "cereal/archives/json.hpp"
#include <vector>
#include <string>
namespace
eos
{
namespace
morphablemodel
{
/**
* Saves coefficients (for example PCA shape coefficients) to a json file.
*
* @param[in] coefficients A vector of coefficients.
* @param[in] filename The file to write.
* @throws std::runtime_error if unable to open the given file for writing.
*/
void
save_coefficients
(
std
::
vector
<
float
>
coefficients
,
std
::
string
filename
)
{
std
::
ofstream
file
(
filename
);
if
(
file
.
fail
())
{
throw
std
::
runtime_error
(
"Error opening file for writing: "
+
filename
);
}
cereal
::
JSONOutputArchive
output_archive
(
file
);
output_archive
(
cereal
::
make_nvp
(
"shape_coefficients"
,
coefficients
));
};
}
/* namespace morphablemodel */
}
/* namespace eos */
#endif
/* COEFFICIENTS_HPP_ */
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