Github地址:https://github.com/YadiraF/face3d
示例:
3dmm. python 2_3dmm.py
left: random example generated by 3dmm
right: fitting face with 3dmm using 68 key points
transform. python 3_transform.py
left:
fix camera position & use orthographic projection. (often used in reconstruction)
then transform face object: scale, change pitch angle, change yaw angle, change roll angle
right:
fix obj position & use perspective projection(fovy=30). (simulating real views)
then move camera position and rotate camera: from far to near, down & up, left & right, rotate camera
light. python 4_light.py
single point light: from left to right, from up to down, from near to far
image map python 6_image_map.py
render different attributes in image pixels.
: depth, pncc, uv coordinates
uv map python 7_uv_map.py
render different attributes in uv coordinates.
: colors(texture map), position(2d facial image & corresponding position map)
Prerequisite
-
Python 2 or Python 3
-
需要以下依赖包
- numpy
- skimage (for reading&writing image)
- scipy (for loading mat)
- matplotlib (for show)
- Cython (for compiling c++ file)
Usage
1.克隆该项目
git clone https://github.com/YadiraF/face3d
cd face3d
2.如果使用C++版本,则需要编译,如果使用numpy版本,可跳过该步
注意:需要修改以下文件
mesh_core.cpp (line 349)
ofstream obj_file(filename);
变为以下:
ofstream obj_file(filename.c_str());
然后编译:
cd face3d/mesh/cython
python setup.py build_ext -i
3.准备BFM数据(如果不使用3dmm,则可以忽略该步)
链接:https://github.com/YadiraF/face3d/blob/master/examples/Data/BFM/readme.md
4.运行examples.[默认使用cython版本,可以把mesh修改为mesh_numpy,来运行numpy版本]
cd examples
python 1_pipeline.py
原作者注释:
对于希望继续研究3D面孔的初学者,我强烈建议您首先按照顺序运行示例,然后查看mesh_numpy中的代码并阅读每个文件开头的注释。 希望这可以帮助!
此外,我是计算机图形学的新手,因此,如果您能指出我的一些错误表达,将不胜感激。 谢谢!