@@ -32,9 +32,10 @@ At the moment, it mainly provides the following functionality:
...
@@ -32,9 +32,10 @@ At the moment, it mainly provides the following functionality:
To use the library in your own project, just add the following directories to your include path:
To use the library in your own project, just add the following directories to your include path:
*`eos/include`
*`eos/include`
*`eos/3rdparty/cereal-1.1.1/include`
*`eos/3rdparty/cereal/include`
*`eos/3rdparty/glm`
*`eos/3rdparty/glm`
*`eos/3rdparty/nanoflann/include`
*`eos/3rdparty/nanoflann/include`
*`eos/3rdparty/eigen/Eigen`
*`eos/3rdparty/eigen3-nnls/src`
*`eos/3rdparty/eigen3-nnls/src`
**Make sure to clone with `--recursive` to download the required submodules!**
**Make sure to clone with `--recursive` to download the required submodules!**
...
@@ -84,9 +85,10 @@ The full model is available at [http://www.cvssp.org/facemodel](http://www.cvssp
...
@@ -84,9 +85,10 @@ The full model is available at [http://www.cvssp.org/facemodel](http://www.cvssp
## Python bindings
## Python bindings
eos includes python bindings for some of its functionality (and more can be added!). Set `-DEOS_GENERATE_PYTHON_BINDINGS=on` when running `cmake` to build them (and optionally set `PYTHON_EXECUTABLE` to point to your python interpreter if it's not found automatically).
eos includes python bindings for some of its functionality (and more can be added!). An experimental package is on PyPI: Try `pip install eos-py`. You will still need the data files from this repository.
In case of issues, build the bindings manually: Clone the repository and set `-DEOS_GENERATE_PYTHON_BINDINGS=on` when running `cmake` (and optionally set `PYTHON_EXECUTABLE` to point to your python interpreter if it's not found automatically).
After building the bindings, they can be used like any python module:
After having obtained the bindings, they can be used like any python module:
@@ -380,7 +380,7 @@ int main(int argc, char *argv[])
...
@@ -380,7 +380,7 @@ int main(int argc, char *argv[])
// Colour model fitting (this needs a Morphable Model with colour (albedo) model, see note above main()):
// Colour model fitting (this needs a Morphable Model with colour (albedo) model, see note above main()):
if(!morphable_model.has_color_model())
if(!morphable_model.has_color_model())
{
{
cout<<"The MorphableModel used does not contain a colour (albedo) model. ImageCost requires a model that contains a colour PCA model. You may want to use the full Surrey Face Model or remove this section.";
cout<<"Error: The MorphableModel used does not contain a colour (albedo) model. ImageCost requires a model that contains a colour PCA model. You may want to use the full Surrey Face Model or remove this section.";
.def("get_shape_model",[](constmorphablemodel::MorphableModel&m){returnm.get_shape_model();},"Returns the PCA shape model of this Morphable Model.")// Not sure if that'll really be const in Python? I think Python does a copy each time this gets called?
.def("get_shape_model",[](constmorphablemodel::MorphableModel&m){returnm.get_shape_model();},"Returns the PCA shape model of this Morphable Model.")// Not sure if that'll really be const in Python? I think Python does a copy each time this gets called?
.def("get_color_model",[](constmorphablemodel::MorphableModel&m){returnm.get_color_model();},"Returns the PCA colour (albedo) model of this Morphable Model.")// (continued from above:) We may want to use py::overload, but in any case, we need to tell pybind11 if it should use the const or non-const overload.
.def("get_color_model",[](constmorphablemodel::MorphableModel&m){returnm.get_color_model();},"Returns the PCA colour (albedo) model of this Morphable Model.")// (continued from above:) We may want to use py::overload, but in any case, we need to tell pybind11 if it should use the const or non-const overload.
.def("get_mean",&morphablemodel::MorphableModel::get_mean,"Returns the mean of the shape- and colour model as a Mesh.")
.def("get_mean",&morphablemodel::MorphableModel::get_mean,"Returns the mean of the shape- and colour model as a Mesh.")
.def("draw_sample",(core::Mesh(morphablemodel::MorphableModel::*)(std::vector<float>,std::vector<float>)const)&morphablemodel::MorphableModel::draw_sample,"Returns a sample from the model with the given shape- and colour PCA coefficients.",py::arg("shape_coefficients"),py::arg("color_coefficients"))
.def("has_color_model",&morphablemodel::MorphableModel::has_color_model,"Returns true if this Morphable Model contains a colour model, and false if it is a shape-only model.")
;
;
morphablemodel_module.def("load_model",&morphablemodel::load_model,"Load a Morphable Model from a cereal::BinaryInputArchive (.bin) from the harddisk.",py::arg("filename"));
morphablemodel_module.def("load_model",&morphablemodel::load_model,"Load a Morphable Model from a cereal::BinaryInputArchive (.bin) from the harddisk.",py::arg("filename"));