Skip to main content

Automatic 3D facial template registration via MVMP + MeshMonk

Project description

AutoFaceMonker

Automatic 3D facial template registration using MVMP landmark detection and MeshMonk nonrigid surface registration.

Given a template mesh and a target 3D face scan, AutoFaceMonker detects 478 MediaPipe facial landmarks via MVMP, aligns the template with Procrustes analysis, then refines the fit with MeshMonk nonrigid registration — no manual intervention required.

Installation

pip install autofacemonker

Requires Python ≥ 3.11.

Quick Start

autofacemonker subject.obj -o warped.ply

This uses the bundled template mesh and built-in 7-point anatomical landmark correspondences.

Python API

from autofacemonker import AutoFaceMonker

# Use default template and correspondences
monker = AutoFaceMonker()
warped_vertices = monker.register("subject.obj", save_path="warped.ply")

Custom template and correspondences

monker = AutoFaceMonker(
    template="my_template.ply",
    correspondences=[
        (0,   3572),   # nasion       → template vertex 3572
        (4,   3589),   # nose tip     → template vertex 3589
        (133, 2436),   # left eye     → template vertex 2436
        (362, 4648),   # right eye    → template vertex 4648
        (61,  2310),   # left mouth   → template vertex 2310
        (291, 4849),   # right mouth  → template vertex 4849
        (152, 3543),   # chin         → template vertex 3543
    ],
    num_iterations=200,
)
warped = monker.register("subject.obj")

CLI

usage: autofacemonker <target.obj> [options]

positional arguments:
  target              Path to target .obj mesh

options:
  -t, --template      Template mesh path (default: bundled template.ply)
  -c, --correspondences
                      JSON file with landmark→vertex mapping
  -o, --out           Output PLY path (default: <target>_warped.ply)
  -n, --iterations    MeshMonk nonrigid iterations (default: 120)

Correspondence JSON format

{"0": 3572, "4": 3589, "133": 2436, "362": 4648, "61": 2310, "291": 4849, "152": 3543}

How It Works

  1. MVMP detects 478 MediaPipe facial landmarks on the target mesh using multi-view 2D projections with 5 zone cameras.

  2. Procrustes rigidly aligns the template using the 7 anatomical landmark correspondences, computing rotation, translation, and uniform scale.

  3. MeshMonk nonrigid refines the fit by deforming the template to match the target surface over 120 iterations.

Requirements

  • Python ≥ 3.11
  • meshmonk ≥ 0.3.0
  • mvmp ≥ 1.3.0
  • trimesh
  • numpy

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

autofacemonker-0.1.3.tar.gz (156.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autofacemonker-0.1.3-py3-none-any.whl (153.4 kB view details)

Uploaded Python 3

File details

Details for the file autofacemonker-0.1.3.tar.gz.

File metadata

  • Download URL: autofacemonker-0.1.3.tar.gz
  • Upload date:
  • Size: 156.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autofacemonker-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d3f1a1bfdfe1cbfec5b32d58d1e5d017e12da4cf67f8bf2d8566db41ef6b1349
MD5 95f58092a0fdc53c471ca59cb8e26b6d
BLAKE2b-256 535f418155e3798213bca493253b9b1ed796b3f693063d167369d6a235fce6a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for autofacemonker-0.1.3.tar.gz:

Publisher: publish.yml on gfacchi-dev/AutoFaceMonker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file autofacemonker-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: autofacemonker-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 153.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for autofacemonker-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8876d8e8b22a4d25154cc04386a190405f68c08a21e6333b76b10e99c9538b04
MD5 ad246e52f34a53de64e5b94b675bfd39
BLAKE2b-256 b7d2fc88b8d8a499bcc252f91eb09f48d25b298ab92978e9f94a22354ad4106d

See more details on using hashes here.

Provenance

The following attestation bundles were made for autofacemonker-0.1.3-py3-none-any.whl:

Publisher: publish.yml on gfacchi-dev/AutoFaceMonker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page