Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
yfeng95 committed Jul 19, 2018
1 parent 54e2c9f commit 9d59fa8
Showing 1 changed file with 38 additions and 30 deletions.
68 changes: 38 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Introduction

I organize this repo just for fun & my personal research.
Hope this helps & you enjoy it. ^_^


Hope this helps and you'll enjoy it. : )

## Structure

Expand All @@ -19,7 +19,7 @@ mesh/ # written in python(numpy)
| render.py # obj to image using rasterization render

# When can not use vercorization to optimize, loops in python are too slow to use.
# So write core parts(loop) in c++, then use cython to compile them.
# So write core parts(loops) in c++, then use cython to compile them for python api.
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.
Expand All @@ -35,55 +35,53 @@ morphabel_model/ # witten in python(numpy)

## Examples:

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

* **3dmm**. `python 2_3dmm.py`

left: random example generated by 3dmm

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

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

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

fix camera position & use orthographic projection. (often used in reconstruction)

transform face object:

scale, change pitch angle, change yaw angle, change roll angle
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)

move camera position and rotate camera:

from far to near, down & up, left & right, rotate camera
then move camera position and rotate camera: from far to near, down & up, left & right, rotate camera

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

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

single point light:
* **light**. `python 4_light.py`

from left to right, from up to down, from near to far
single point light: from left to right, from up to down, from near to far

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

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

render different attributes in image pixels.

: depth, pncc, uv coordinates

![](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`
* **uv map** `python 7_uv_map.py`

render different attributes in uv coordinates.

: colors(texture map), position(2d facial image & corresponding position map)



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


Expand All @@ -92,34 +90,44 @@ morphabel_model/ # witten in python(numpy)

### Prerequisite

- Python 3 (python 2 should work, but I haven't tested)
- Python 2 or Python 3

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


### Usage

1. Clone the repository

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

2. Compile c++ files (ignore if you use numpy version)
2. Compile c++ files to .so for python use (ignore if you use numpy version)

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

3. Prepare **BFM** Data (ignore if you don't use 3dmm)
see [Data/BFM/readme.md](https://github.com/YadiraF/face3d/blob/master/examples/Data/BFM/readme.md)
4. Run examples
(examples use cython version, you can change `mesh_cython` into `mesh` to use numpy version)
```bash
cd examples
python 1_pipeline.py
```

0 comments on commit 9d59fa8

Please sign in to comment.