patrikhuber / eos

A lightweight 3D Morphable Face Model library in modern C++
Apache License 2.0
1.89k stars 596 forks source link

Get a frontal 2D image in Python #294

Open siarez opened 4 years ago

siarez commented 4 years ago

I want to do the same thing as issues #37. Namely, get a 2D frontal image. But I need to do it in Python. Is it achievable with the current python bindings, or do the bindings need to be expanded to support this? If it is the later, pointers on how to do it will be appreciated.

patrikhuber commented 4 years ago

Sure, just try it. python/demo.py can probably do most of what you'd like. Note that I think you'll have to build the Python bindings from the devel branch (to get the fix in dc0fce864caf87648ac116d8ca1b2cf55435b65a). Clone the eos repo manually (follow the Readme.md instructions), switch to the devel branch, then do pip install ./eos and pip will build and install the module from the local directory.

For creating/visualising the frontal rendering, I suggest that you use the returned Mesh and texture, and then some Python OpenGL library to render the mesh however you'd like to have. Perhaps PyOpenGL or PyGame or something more modern, I am not very familiar with Python rendering libraries.