Update readme with documentation for the new perspective options.

This commit is contained in:
Nathan Vegdahl 2022-06-23 00:09:17 -07:00
parent d538041c9d
commit 0b4a0712b4

View File

@ -11,6 +11,29 @@ $ face_track.py path/to/video_file.mp4 path/to/output.mdd
This will create `output.mdd`, a NewTek MDD file. This file contains animated vertex data, which can be used to animate the face mesh in `face_mesh.obj` or `face_mesh.blend`. For example, by using the Mesh Cache modifier in Blender. This will create `output.mdd`, a NewTek MDD file. This file contains animated vertex data, which can be used to animate the face mesh in `face_mesh.obj` or `face_mesh.blend`. For example, by using the Mesh Cache modifier in Blender.
## Accounting for Perspective
By default, this script just spits out the direct results of Google's Mediapipe library. Those results assume an orthographic camera, meaning that as the face gets closer/further away from the camera, the resulting face mesh actually gets bigger/smaller rather than adjusting its z-depth.
To get a face mesh that (more or less) accounts for perspective, you can specify the camera's field of view. The script will then process the face mesh data to be consistent with that. (Note that this does not produce perfect results by any stretch, but it may be workable for certain use cases at least.)
You can specify the field of view in one of two ways. Either in (horizontal) degrees:
```bash
$ face_track.py --fov 85 path/to/video_file.mp4 path/to/output.mdd
```
Or with a sensor-size/lens-length pair:
```bash
$ face_track.py --lens_len 35/50 path/to/video_file.mp4 path/to/output.mdd
```
Both options are designed to match the perspective camera model in Blender, and using the exact same camera settings should result in perfect alignment with that camera.
A separate blend file, `face_mesh_perspective.blend`, is provided with the basic setup for a perspective-corrected face mesh generated this way.
## Requirements ## Requirements
face_track.py requires the following: face_track.py requires the following: