Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yfeng95 committed Jul 17, 2018
0 parents commit 7a2298a
Showing 1 changed file with 97 additions and 0 deletions.
97 changes: 97 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# face3d: python tools for processing 3d face

## Introduction

I organize this repo just for fun & my personal research use.

Hope this helps and you can enjoy it. : )



## Structure

```python
# Since triangle mesh is the most popular representation of 3D face, the main part is mesh processing.
mesh/ # written in python(numpy)
| io.py # read & write obj
| vis.py # plot mesh
| transform.py # transform mesh & estimate matrix
| light.py # add light & estimate light(to do)
| render.py # obj to image using rasterization render

# When can not use vercorization to optimize, loop in python is too slow to use. So write core parts(loop) in c++, then use cython to compile it.
mesh_cython/ # written in c++(cython)
| render.py # the same API as in mesh/render.py, with faster speed.
| light.py # the same API as in mesh/light.py, with faster speed.
| mesh_core* # c++ codes of core parts.

# 3DMM is one of the most popular methods to generate & reconstruct 3d face.
morphabel_model/ # witten in python(numpy)
| morphable_model.py # morphable model class: generate & fit
| fit.py # estimate shape&expression parameters. 3dmm fitting.
| load.py # load 3dmm data
```


## Examples:

* **3dmm**. `run examples/2_3dmm.py`

left: random examples generated by 3dmm

right: 3d face generated by fitted 3dmm&pose parameters using 68 key points

![](examples/results/3dmm/generated.jpg)![](examples/results/3dmm/fitted.jpg)

* **transform.** `python examples/3_transform.py`

![](examples/results/transform/obj.gif)![](examples/results/transform/camera.gif)

* **light**. `python examples/4_light.py`

![](examples/results/light/position.gif)

* **image map** `python examples/6_image_map.py`

![](examples/results/image_map/depth.jpg) ![](examples/results/image_map/pncc.jpg) ![](examples/results/image_map/uv_coords.jpg)

* **uv map** `python examples/7_uv_map.py`

![](examples/results/uv_map/uv_texture_map.jpg)![](examples/results/uv_map/uv_position_map.jpg)![](examples/results/uv_map/image.jpg)



## Getting Started

### Prerequisite

- Python 3+ (numpy, skimage, scipy)

- Python packages:
* numpy
* skimage (for reading&writing image)
* scipy (for loading mat)
* Cython (for compiling c++ files)

- BFM Data

see [Data/BFM/readme.md](Data/BFM/readme.md)

### Usage

1. Clone the repository

```bash
git clone https://github.com/YadiraF/face3d
cd face3d
```

2. Compile c++ files(ignore if you use numpy version)

```bash
cd face3d/mesh_cython
python setup.py build_ext -i
```

3. Run examples

0 comments on commit 7a2298a

Please sign in to comment.