Skip to main content

mesh-projector-pylib

Purpose

Python bindings for the mesh-projector-rs Rust backend. The package loads OBJ meshes, applies reusable geometry preprocessing, renders image projections, and generates colored point clouds through surface sampling.

The PyPI distribution is named mesh_projector; its Python import is mesh_projector.

mesh-projector-rs provides the core mesh operations and CPU/GPU implementations. MAPPE uses this package to generate its image and point-cloud features.

Requirements

  • Python 3.11 or 3.12 (>=3.11,<3.13), as declared in pyproject.toml. The configuration module uses enum.StrEnum, which requires Python 3.11 or later.
  • NumPy, Pydantic, and the other declared runtime dependencies.
  • For source builds: a current stable Rust toolchain, Cargo, a native linker/C compiler, Git, and Maturin.
  • For GPU execution: a wgpu-compatible GPU adapter and drivers; Linux typically requires a working Vulkan driver stack.

The default renderer uses the CPU.

Installation

From PyPI

In a Python 3.11 or 3.12 environment:

python -m pip install mesh_projector

A compatible wheel does not require a local Rust toolchain. To build from source, use the checkout instructions below.

From source

git clone https://github.com/arthurhscarvalho/mesh-projector-pylib.git
cd mesh-projector-pylib
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install "maturin>=1.13.1,<2.0"
python -m maturin develop --release

Cargo fetches the core, CPU, and GPU crates from the public mesh-projector-rs Git tag v1.0.0, as declared in Cargo.toml. No sibling backend checkout is required. The activation command above is for a POSIX shell. Re-run python -m maturin develop --release after changing the binding or updating its backend dependency.

Usage

Mesh preprocessing and projection

Run the following example from the repository root to use the bundled asset. For a PyPI-only installation, replace the OBJ path with your own file and preserve its material and texture paths.

import math
import mesh_projector as mp

render_config = mp.RenderConfig(resolution=256, use_gpu_renderer=False)
mesh = mp.read_mesh("assets/just_a_girl_C0-L5_deq_tri.obj", render_config)
preprocessing = mp.build_preprocessing(mesh, render_config)
mesh = mp.apply_preprocessing(mesh, preprocessing)

view_angles = [
    (0.0, 0.0, 0.0),
    (0.0, math.pi, 0.0),
    (0.0, math.pi / 2.0, 0.0),
    (0.0, -math.pi / 2.0, 0.0),
    (math.pi / 2.0, 0.0, 0.0),
    (-math.pi / 2.0, 0.0, 0.0),
]
images, depths, normals, occupancies = mp.project_to_images(
    mesh, mp.ImageProjectionConfig(), view_angles
)
points, colors = mp.project_to_point_cloud(
    mesh, mp.PointCloudProjectionConfig(density_factor=0.01)
)

print(images.shape)  # (6, 256, 256, 4)
print(points.shape, colors.shape)  # Both (N, 3)

For paired quality assessment, build the preprocessing recipe from the reference mesh and apply that same recipe to both meshes. apply_preprocessing returns a new mesh. Alternatively, pass the recipe as the optional preprocessing argument to a projection function on a raw mesh.

Output Shape and dtype
Image projections (V, H, W, 4), uint8 RGBA.
Depth maps (V, H, W), uint8.
Normal maps (V, H, W, 4), uint8; use [..., :3] for the three normal channels.
Occupancy maps (V, H, W), uint8; 255 denotes mesh coverage.
Sampled points (N, 3), float32 XYZ coordinates.
Sampled colors (N, 3), uint8 RGB values in [0, 255].

V is the number of supplied views; H and W equal RenderConfig.resolution. View angles are Euler rotations in radians. Treat image outputs as read-only. The point count depends on the mesh, resolution, and sampling density.

Set use_gpu_renderer=True when creating RenderConfig to request GPU rendering and sampling. If GPU initialization or projection fails, the Python extension logs a warning and falls back to the CPU implementation. Lighting, camera, antialiasing, ambient occlusion, and background settings are defined in python/mesh_projector/config.py.

File export examples

Install the optional example dependencies, then run from the repository root:

python -m pip install open3d opencv-python
python examples/project_on_bounding_cube.py
python examples/project_to_point_cloud.py

examples/project_on_bounding_cube.py saves projection, depth, normal, and occupancy PNG files in projections/. examples/project_to_point_cloud.py saves point_cloud.ply. These examples request the GPU renderer and use the bundled asset; edit their input paths and configurations as needed.

Publications

The mesh processing and Triangular Area-Adaptive Point Sampling (TAPS) functionality is described as part of MAPPE:

  1. Arthur Henrique Silva Carvalho and Pedro Garcia Freitas. “MAPPE: Mesh Assessment via Point Cloud and Projection Estimators.” Signal Processing: Image Communication, vol. 150, article 117722, 2027. DOI: 10.1016/j.image.2026.117722. Available online 5 October 2026.
@article{carvalho2027mappe,
  author  = {Carvalho, Arthur Henrique Silva and Freitas, Pedro Garcia},
  title   = {{MAPPE}: Mesh Assessment via Point Cloud and Projection Estimators},
  journal = {Signal Processing: Image Communication},
  volume  = {150},
  pages   = {117722},
  year    = {2027},
  doi     = {10.1016/j.image.2026.117722}
}

License

MIT License.

Metadata

Release files for mesh-projector 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for mesh-projector 1.0.0
File
mesh_projector-1.0.0-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
mesh_projector-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.28+ x86-64 Details
mesh_projector-1.0.0-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
mesh_projector-1.0.0-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
mesh_projector-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.28+ x86-64 Details
mesh_projector-1.0.0-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details

Total release size: 23.0 MB

Release files / mesh_projector-1.0.0-cp312-cp312-win_amd64.whl

Download URL mesh_projector-1.0.0-cp312-cp312-win_amd64.whl
Size 4.0 MB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
d7dd01b4bd53575aa28064e99ce1de6fb91f2f7b24a92544b68aafca911bd05d
BLAKE2b-256 checksum
How to use checksums
45226aed0d57a67f0a73487f969cb6e310c430de3ffc8199c4ae3f619b6dbfbf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / mesh_projector-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl

Download URL mesh_projector-1.0.0-cp312-cp312-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.12 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1f41f359a34ac6c866a06ebcdaec5864692484d2fc06f3444b8e3a2896ae68ef
BLAKE2b-256 checksum
How to use checksums
b90cd400cb3d884b577fdfd1227225050d1512a60385af2408018a0384bad217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / mesh_projector-1.0.0-cp312-cp312-macosx_11_0_arm64.whl

Download URL mesh_projector-1.0.0-cp312-cp312-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
59d3446174749e13837b4a21ab3009190a27dfc6518cdcdceb74d011eced840d
BLAKE2b-256 checksum
How to use checksums
f1707f109509e4e9fab8dffe8c9c4e922c81297cc3fc41fb550d25ccff52f9b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / mesh_projector-1.0.0-cp311-cp311-win_amd64.whl

Download URL mesh_projector-1.0.0-cp311-cp311-win_amd64.whl
Size 4.0 MB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
5679d25de5180ee082d03a57758fcaef884502168b18a08ec448ee9922a4c195
BLAKE2b-256 checksum
How to use checksums
99718f8660e4a96c095dffb5f4c0897b1b98d4bd6a2d0522166136af7c5c26e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / mesh_projector-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl

Download URL mesh_projector-1.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Size 4.2 MB
Tags CPython 3.11 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
e1dd4b6915b820c25b917f5e500765290e583c799bebdf8348694d9f3bd41457
BLAKE2b-256 checksum
How to use checksums
7c8cf7ad1121989d77daacdf9ade53a0d2e154665928103c29ed62d4ebb547f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / mesh_projector-1.0.0-cp311-cp311-macosx_11_0_arm64.whl

Download URL mesh_projector-1.0.0-cp311-cp311-macosx_11_0_arm64.whl
Size 3.3 MB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
773f51d82b6cfc6fb873752b45ceb18ef09aceee50ce8ddcd31730a21066f66b
BLAKE2b-256 checksum
How to use checksums
d36c5e855ce6cfe4ef8825efed3ced27433d7a9e6052cae49aa5074444fbc85d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for mesh-projector 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.0.0 This release

6 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page