Skip to main content

pixelmap-multiview-python

PyPI Python versions License: MIT

Turn a set of ordinary photos of a scene into a textured 3D model.

Python bindings for the pixelmap_multiview Rust crate. It maps every pair of three or more photos with pixelmap's dense correspondence, works out where each photo was taken from, and fuses all of the views into one mesh. You don't need calibration, markers or measurements.

These 23 phone photos were taken while walking once around a statue:

Twenty-three photos of a bronze statue of a woman carrying a child, taken from all sides while walking around it

The mesh fused from them, shown untextured in MeshLab from three sides:

The reconstructed 3D mesh of the statue, seen from three different angles

Install

pip install pixelmap-multiview-python            # the library; NumPy is the only dependency
pip install "pixelmap-multiview-python[images]"  # plus Pillow, for load_photos()

The distribution is pixelmap-multiview-python, and the import name is pixelmap_multiview. Wheels are published for Linux (x86-64, aarch64, musl), macOS (Apple silicon and Intel) and Windows (x86-64), for CPython 3.9 and newer. You only need a Rust toolchain to build from source.

Quick start

import pixelmap_multiview as pmv

photos, focal = pmv.load_photos(["a.jpg", "b.jpg", "c.jpg", "d.jpg"])
model = pmv.reconstruct(photos, quality="medium", focal_35mm=focal)

print(model)  # <pixelmap_multiview.Model 23314 vertices, 45708 triangles, 4 of 4 photos>
model.save("out/statue.obj")  # + statue.mtl + statue_texture.png, for MeshLab or Blender
model.save("out/statue.html")  # open it in a browser and turn the model around

load_photos turns each photo upright according to its EXIF orientation and scales it to 1200 px on the long side. It also returns the 35 mm-equivalent focal length from EXIF when every photo records the same one. Photos from anywhere else work too: pass a list of uint8 arrays (H, W, 3), (H, W, 4) or (H, W), or Pillow images, all the same size.

What you get

Attribute Contents
model.vertices, model.normals (V, 3) float64
model.triangles (T, 3) uint32, counter-clockwise seen from the normal's side
model.vertex_colours (V, 3) uint8
model.texture.atlas (H, W, 4) uint8, with each part of the surface taken from the photo that sees it best
model.texture.texcoords, .face_texcoords, .face_views the atlas mapping, OBJ convention
model.intrinsics fx, fy, cx, cy, .matrix, and whether the focal length was provided, from EXIF, estimated or refined
model.cameras a Pose per photo (rotation, translation, centre, matrix), or None for a photo left out
model.pairs what two-view geometry made of each pair: coverage, relative pose, inlier ratio, and why it was rejected

All of these are in one frame. The first camera of the best pair sits at the origin looking along +z with +y down the image, and the distance between that pair's cameras is the unit of length. Nothing is metric.

Saving

model.save(path) picks the format from the suffix:

Suffix Writes Opens in
.obj textured Wavefront OBJ, plus <stem>.mtl and <stem>_texture.png MeshLab, Blender, CloudCompare
.x3d textured X3D, plus <stem>_texture.png MeshLab, X3D viewers
.glb binary glTF 2.0, one file with the texture embedded Blender, Windows 3D Viewer, three.js, most game engines
.html one web page with the textured model embedded, shown in 3D any browser
.ply ASCII PLY with a colour per vertex viewers that do not load textures

It returns every file it wrote. The .html page is titled after the file's stem unless you pass title="...". The model is embedded in the page, but the viewer, Google's <model-viewer>, is fetched from cdn.jsdelivr.net, so opening the page needs a network connection. Every format is turned half a revolution about x so that viewers show the model upright; the arrays on model are not turned.

Following along and stopping

A run takes minutes of work. on_event hears about all of it, as data rather than prose:

def on_event(event):
    if event.progress is not None:  # None for log lines and dropped photos
        print(f"{event.progress:5.1%}  {event.message}")
    if isinstance(event, pmv.PairMapped):
        event.points  # (rows, cols, 2): the dense correspondence for this pair, NaN where unmapped


model = pmv.reconstruct(photos, on_event=on_event)

The events are Started, StageProgress, PairProgress, PairMapped, PairRejected, ViewDropped and Log. Each one carries stage, progress and message, along with its own fields. If on_event raises an exception, the run stops at the next checkpoint and the exception propagates. Ctrl-C stops a run the same way.

To keep your own thread free, run the reconstruction as a Job:

job = pmv.Job(photos, quality="medium")
for event in job:  # each event as it happens; ends when the run does
    print(f"{job.status.progress:.0%} {event.message}")
model = job.join()

For code with its own event loop, job.next_event(timeout=0) polls without waiting, and job.status works from any thread. After job.cancel(), join() raises CancelledError, well within a second.

When a capture fails

A run that can't produce a correct model raises an exception rather than returning a plausible-looking wrong one. Each exception names the stage that failed and says what to change:

try:
    model = pmv.reconstruct(photos)
except pmv.ReconstructionError as err:
    print(err.stage, err.reason)  # tracks too_few_tracks
    # only 338 points could be followed across three or more photos (need 500);
    # the photos share too little of the scene
    print(err)

InvalidInputError (also a ValueError) covers too few photos, photos of different sizes, and photos that are too small. ReconstructionError covers captures that can't be reconstructed: a camera that only turned, a flat scene, or photos with too little in common. Match on err.reason rather than on the message. The failure's details are attributes, such as err.found and err.required.

For a good capture:

  • Step sideways between shots rather than turning on the spot.
  • Let neighbouring photos overlap generously.
  • Keep one camera at one zoom setting throughout.

Time complexity

Mapping the pairs dominates: N photos take N(N−1)/2 pixelmap runs, one after another, so the time grows with the square of the number of photos. Four photos make 6 pairs; the 23 photos of the statue make 253. One pair of portrait 4:3 photos takes, by the size of the photos (width × height):

Quality 600×800 900×1200 1350×1800 2400×3200
low 0.25 s 0.24 s 0.23 s 0.24 s
medium 0.73 s 1.10 s 1.04 s 1.02 s
high 0.92 s 1.68 s 3.02 s 3.93 s
ultra 0.93 s 1.67 s 2.93 s 6.18 s

So the statue at medium, loaded at the default 1200 px, spends about four and a half minutes mapping pairs. These are medians over nine pairs (three runs over three of the statue photos), timed through on_event with pixelmap_multiview 0.2.0, on a six-core Intel Core i7-9750H laptop. Expect other machines to be proportionally faster or slower.

pixelmap scales both photos down to a working width before matching them: 400 px for low, 800 px for medium, 1600 px for high and 3200 px for ultra. It never scales them up, so a preset works at the photos' own width when they are narrower than that. That is why low and medium take about the same time whatever the size, and why high and ultra slow down as the photos grow. ultra is the same as high until the photos are wider than 1600 px. A wider working width also gives a denser mesh with more precise geometry: on 900 px-wide photos high gives about a quarter of the points that 0.1.2 did by scaling them up to 1600 px. Pass load_photos a larger max_size for a denser model. Runs are deterministic: the same photos, quality and seed give the same model.

Tuning the correspondence

Two keywords pass pixelmap's neighborhood radius straight through, for a caller tuning how each pair is mapped. They mean what they mean in pixelmap, and left at None pixelmap's default of 5 applies:

model = pmv.reconstruct(photos, quality="high", init_neighborhood_radius=9)
  • neighborhood_radius is the radius, in working pixels, of the disc pixelmap compares the two photos over, in every step. A larger disc matches weakly textured or strongly warped regions more reliably, but blurs the mapping across depth edges, and the time per pair grows with its area: 9 roughly doubles it.
  • init_neighborhood_radius is the same for the initial solve alone, the one that grows each pair's mapping out from its feature matches. On pixelmap's benchmarks 9 here was the cheap gain, for 20–30% more time per pair.

Both take an int from 1 to pmv.MAX_NEIGHBORHOOD_RADIUS (51). Every mapped cell becomes a 3D point, so judge a change by the model it gives rather than by pixelmap's benchmarks.

Development

python -m venv .venv && . .venv/bin/activate
pip install maturin pytest pillow ruff numpy
maturin develop --release   # release matters: the tests run whole reconstructions
pytest

License

MIT

Metadata

Release files for pixelmap-multiview-python 0.2.0

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

Source distribution (sdist)

Source distribution for pixelmap-multiview-python 0.2.0
File Size Uploaded Provenance Actions
pixelmap_multiview_python-0.2.0.tar.gz 44.5 kB With provenance Details for pixelmap_multiview_python-0.2.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for pixelmap-multiview-python 0.2.0
File Actions
pixelmap_multiview_python-0.2.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details for pixelmap_multiview_python-0.2.0-cp39-abi3-win_amd64.whl
pixelmap_multiview_python-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl CPython 3.9 abi3 Linux musl 1.2+ x86-64 Details for pixelmap_multiview_python-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 abi3 Linux glibc 2.17+ x86-64 Details for pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.9 abi3 Linux glibc 2.17+ ARM64 Details for pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details for pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details for pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Total release size: 4.6 MB

Release files / pixelmap_multiview_python-0.2.0.tar.gz

Download URL pixelmap_multiview_python-0.2.0.tar.gz
Size 44.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c824cf0babd4cbe99f1f06a6f64dc5868c58bebd994453dfdabc0c5b2609b18e
BLAKE2b-256 checksum
How to use checksums
acbc71281f088c62033e73ccb74e5b4441e8fc3e6c96fff0436a227e850516db
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pixelmap_multiview_python-0.2.0-cp39-abi3-win_amd64.whl

Download URL pixelmap_multiview_python-0.2.0-cp39-abi3-win_amd64.whl
Size 660.6 kB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
a206c90ba366b085f44be849606481e53a2ea09aa5c97746797eb406cbb80ca4
BLAKE2b-256 checksum
How to use checksums
76a34bb9db34dce859ce2fdbde4923513d69efbe7d0d7bf730e9b878fb4ca34b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pixelmap_multiview_python-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl

Download URL pixelmap_multiview_python-0.2.0-cp39-abi3-musllinux_1_2_x86_64.whl
Size 981.4 kB
Tags CPython 3.9 Linux musl 1.2+ x86-64 abi3
SHA-256 checksum
How to use checksums
a16a8975999ec10b5663dd64f68029c82298d6c27b9ad15deaa190d943c56e29
BLAKE2b-256 checksum
How to use checksums
0503a5a31e40b2a8e73fa651c6af2682a5a9913106001fb66fc28e49e1280f9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 772.2 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
69bbf2298c1c217d446781591bceaf3376824edea090f8f5a5f215b05e08f33c
BLAKE2b-256 checksum
How to use checksums
dedffbd851aadd24ada403773b1e4187e2ce2cbe8fa757f597a0ebd163ae81dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL pixelmap_multiview_python-0.2.0-cp39-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 735.2 kB
Tags CPython 3.9 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
4f54373920464e86857a17957751145667d56ca139905dd2fa6a9235dc29b4d7
BLAKE2b-256 checksum
How to use checksums
fb87301d9a244742415729ec07b53d81ce9754a973635a80aa0aa7ba81fbd18e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_11_0_arm64.whl
Size 688.3 kB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3c6d6d65de5b4715f70db1e810f9c36a21b99dbcba67b680c1d319a38aad3d8c
BLAKE2b-256 checksum
How to use checksums
8a2615b46983a9121f9c8d229214dcaa6d7e1878c083dea6514a737c625d8a12
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Release files / pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL pixelmap_multiview_python-0.2.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 715.5 kB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
456be1c7d40d1a71c9d9a6388c40784fa64738bd2b42ac384f387f2005f84c24
BLAKE2b-256 checksum
How to use checksums
e154673ee696d105ec80829a2790e2d901a6edc1c559e510f104bd1f6c2dccc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

Security for pixelmap-multiview-python 0.2.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.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for pixelmap_multiview_python-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 22, 2026.

Transparency log

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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