Skip to main content

3D Multi-View MediaPipe - Facial landmark detection for 3D meshes

Project description

MVMP: 3D Multi-View MediaPipe

License Framework Face Landmarker

Description

MVMP (Multi-View MediaPipe) is a lightweight tool for 3D facial landmark detection on static textured meshes. It renders multiple camera views of the mesh, detects 2D landmarks with MediaPipe, and backprojects them into 3D space through DBSCAN-based consensus triangulation. The result is 478 facial landmarks aligned with the 3D mesh geometry, with robust outlier rejection.

Supported mesh formats: .obj, .ply, .stl, .gltf, .glb, .off

Installation

pip install mvmp

The MediaPipe Face Landmarker model is bundled in the package.

From Source

git clone https://github.com/gfacchi-dev/mvmp.git
cd mvmp
pip install .

Usage

Python API

from mvmp import Facemarker

# Create a detector
marker = Facemarker()

# Detect landmarks on a mesh
result = marker.predict("path/to/mesh.obj")
print(result)  # FacemarkerResult(478 landmarks, 478 vertex indices)

# Access results
landmarks_3d = result.landmarks_3d          # list of [x, y, z] coordinates (original scale)
vertex_indices = result.closest_vertices_ids  # closest mesh vertex per landmark

# Save to JSON
result.save_json("landmarks.json")

More projections = more accuracy

marker = Facemarker(projections=500)
result = marker.predict("mesh.obj")

Custom camera angles

Instead of random projections, specify exact (yaw, pitch) angles in degrees:

marker = Facemarker(camera_angles=[
    (0, 0),       # front view
    (30, 0),      # 30 degrees right
    (-30, 0),     # 30 degrees left
    (0, -20),     # looking up
    (0, 15),      # looking down
])
result = marker.predict("mesh.obj")

Process multiple meshes

marker = Facemarker(projections=200)

for mesh_path in mesh_files:
    result = marker.predict(mesh_path)
    result.save_json(f"output/{mesh_path.stem}.json")

Quiet mode

marker = Facemarker(verbose=False)
result = marker.predict("mesh.obj")

Command Line

mvmp path/to/mesh.obj -p 100 -o output/

# Process all mesh files in a directory (supports .obj, .ply, .stl, .gltf, .glb, .off)
mvmp meshes/ -p 200 -o results/

Arguments:

  • path: Path to mesh file or directory
  • -p, --projections-number: Number of projections (default: 500)
  • -o, --output-path: Output directory

Output Format

JSON output contains coordinates at the original mesh scale:

{
  "coordinates": [[x, y, z], ...],
  "closest_vertex_indexes": [idx1, idx2, ...]
}

Results

Contributing

  1. Fork the repository and create a feature branch.
  2. Make your changes with clear commit messages.
  3. Open a pull request.

License

MIT License

Contact

Questions or suggestions? Open an issue on GitHub.

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

mvmp-0.2.11.tar.gz (3.4 MB view details)

Uploaded Source

Built Distribution

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

mvmp-0.2.11-py3-none-any.whl (3.4 MB view details)

Uploaded Python 3

File details

Details for the file mvmp-0.2.11.tar.gz.

File metadata

  • Download URL: mvmp-0.2.11.tar.gz
  • Upload date:
  • Size: 3.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mvmp-0.2.11.tar.gz
Algorithm Hash digest
SHA256 8ce46ce6cf248e86c9e351a313bcbe1095010164270453a6b062e2152a52893e
MD5 9922fbdc998653d3cf28b9cc43e5cf7d
BLAKE2b-256 c1f6c488616f7319dbf1eebaa25a0029fd8faaac8dd6e5faa1df99de8a7a907d

See more details on using hashes here.

File details

Details for the file mvmp-0.2.11-py3-none-any.whl.

File metadata

  • Download URL: mvmp-0.2.11-py3-none-any.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for mvmp-0.2.11-py3-none-any.whl
Algorithm Hash digest
SHA256 f45f6eca4b63ac682f5c654b6eae9d0d447f69352e75b8f20d8525a85f9f5e3a
MD5 5d8d9132b40109d60e6ad6e44d92f4fb
BLAKE2b-256 bc45432bc4c5c03418ea2fa5136fb741b0264d1f33147460de0e72e8eadbd78b

See more details on using hashes here.

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