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
6033ef4f
Commit
6033ef4f
authored
Dec 21, 2015
by
Patrik Huber
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added code to represent and load blendshapes
parent
07b4b0e0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
88 additions
and
0 deletions
+88
-0
CMakeLists.txt
CMakeLists.txt
+1
-0
include/eos/morphablemodel/Blendshape.hpp
include/eos/morphablemodel/Blendshape.hpp
+87
-0
No files found.
CMakeLists.txt
View file @
6033ef4f
...
...
@@ -92,6 +92,7 @@ set(HEADERS
include/eos/core/LandmarkMapper.hpp
include/eos/morphablemodel/PcaModel.hpp
include/eos/morphablemodel/MorphableModel.hpp
include/eos/morphablemodel/Blendshape.hpp
include/eos/morphablemodel/io/cvssp.hpp
include/eos/morphablemodel/io/mat_cerealisation.hpp
include/eos/fitting/affine_camera_estimation.hpp
...
...
include/eos/morphablemodel/Blendshape.hpp
0 → 100644
View file @
6033ef4f
/*
* Eos - A 3D Morphable Model fitting library written in modern C++11/14.
*
* File: include/eos/morphablemodel/Blendshape.hpp
*
* 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.
*/
#pragma once
#ifndef BLENDSHAPE_HPP_
#define BLENDSHAPE_HPP_
#include "eos/morphablemodel/io/mat_cerealisation.hpp"
#include "cereal/types/string.hpp"
#include "cereal/archives/binary.hpp"
#include "opencv2/core/core.hpp"
#include <string>
#include <fstream>
namespace
eos
{
namespace
morphablemodel
{
/**
* @brief A class representing a 3D blendshape.
*
* A blendshape is a vector of offsets that transform the vertices of
* a given mesh or shape instance. Usually, a blendshape is associated
* with a deformation like a particular facial expression or a phoneme.
*/
struct
Blendshape
{
std
::
string
name
;
///< Name of the blendshape.
cv
::
Mat
deformation
;
///< A 3m x 1 col-vector (xyzxyz...)', where m is the number of model-vertices. Has the same format as PcaModel::mean.
friend
class
cereal
::
access
;
/**
* Serialises this class using cereal.
*
* @param[in] ar The archive to serialise to (or to serialise from).
*/
template
<
class
Archive
>
void
serialize
(
Archive
&
archive
)
{
archive
(
name
,
deformation
);
};
};
/**
* Helper method to load a file with blendshapes from
* a cereal::BinaryInputArchive from the harddisk.
*
* @param[in] filename Filename to a blendshapes-file.
* @return The loaded blendshapes.
* @throw std::runtime_error When the file given in \c filename fails to be opened (most likely because the file doesn't exist).
*/
std
::
vector
<
Blendshape
>
load_blendshapes
(
std
::
string
filename
)
{
std
::
vector
<
Blendshape
>
blendshapes
;
std
::
ifstream
file
(
filename
,
std
::
ios
::
binary
);
if
(
file
.
fail
())
{
throw
std
::
runtime_error
(
"Error opening given file: "
+
filename
);
}
cereal
::
BinaryInputArchive
input_archive
(
file
);
input_archive
(
blendshapes
);
return
blendshapes
;
};
}
/* namespace morphablemodel */
}
/* namespace eos */
#endif
/* BLENDSHAPE_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