mumfordshah2d (Python / Rust)
Python / Rust port of the MATLAB / Java MumfordShah2D library. Edge-preserving image restoration via the piecewise-smooth Mumford-Shah model of Hohm, Storath, and Weinmann (Inverse Problems 31(11), 2015).
Status: 0.5.2 — Phase 4 (beta). The 4-connected (anisotropic) 2-D Mumford-Shah ADMM driver is ported and verified at 1e-9 element-wise against MATLAB. 8-connected and ρ-coupled variants remain on the roadmap. See
PORTED_BY.mdfor the phasing plan.
Installation
From PyPI:
pip install mumfordshah2d
From source (requires Rust + maturin):
pip install maturin
maturin develop --release
Or as a regular editable install (also builds the Rust core):
pip install -e .
Quick check
import mumfordshah2d
print(mumfordshah2d.__version__) # 0.1.0
print(mumfordshah2d.__original_authors__) # Kilian Hohm, Martin Storath, Andreas Weinmann
import numpy as np
from mumfordshah2d import gauss_l2_mum_solve
# L2-Mumford-Shah within-segment smoothing on a noisy step:
y = np.array([0.0, 0.1, -0.05, 1.05, 0.95, 1.1])
mu = gauss_l2_mum_solve(y, alpha=2.0)
print(mu)
What's currently exported
# Utilities
soft_threshold, hard_threshold, expand_weights, rotate90, psnr
# Prox handles for the ADMM data-fidelity term
make_prox_l2w, make_prox_l1w, make_prox_l0w, make_prox_inpaint
# Phase 1 Rust primitive (exposed for testing)
gauss_l2_mum_solve
# Metadata
__version__, __original_authors__, __ported_by__
The full public API (min_l2_l2_mumford_shah_2d etc.) ships in Phase 4. Until
then, use the original MATLAB code in mumfordShah2D.m for end-to-end
restoration — that path is unchanged by this port.
Array conventions
- Python API: grayscale arrays are
(rows, cols); colour/multichannel arrays are(rows, cols, channels)(numpy / imageio convention). - Internal Rust core:
(channels, rows, cols)(Java / MATLAB convention). - A single conversion happens at the PyO3 boundary in
src/lib.rs.
Verification approach (Phases 2–5)
The Java .class files in Java/bin/mumfordShah/ are kept on disk as a
reference oracle. From Phase 2 onwards, every Rust algorithm is fuzzed
against the Java implementation via a small TestHarness.java subprocess
shim, ensuring bit-equivalent (≤ 1e-12) results on hundreds of random
inputs.
License
MIT, copyright Kilian Hohm, Martin Storath, Andreas Weinmann (original) and
the Claude Sonnet coding agent contribution (Anthropic, 2026, port). See
LICENSE and PORTED_BY.md.
Release files for mumfordshah2d 0.5.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mumfordshah2d-0.5.2.tar.gz | 15.1 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| mumfordshah2d-0.5.2-cp39-abi3-win_amd64.whl | CPython 3.9 | abi3 | Windows x86-64 | Details |
| mumfordshah2d-0.5.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| mumfordshah2d-0.5.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.9 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| mumfordshah2d-0.5.2-cp39-abi3-macosx_11_0_arm64.whl | CPython 3.9 | abi3 | macOS 11.0+ ARM64 | Details |
| mumfordshah2d-0.5.2-cp39-abi3-macosx_10_12_x86_64.whl | CPython 3.9 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 16.7 MB
Release files / mumfordshah2d-0.5.2.tar.gz
| Download URL | mumfordshah2d-0.5.2.tar.gz |
|---|---|
| Size | 15.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
14dec1334a0f0565353f683063e2d651e69da2023170e767353af6967d0f19c0
|
|
BLAKE2b-256 checksum How to use checksums |
4d6631e7acbc9dc4d37a9b9fcdae7b94316775a2f9a48e36f48f97b0c8d64ee7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 11, 2026.
Transparency logRelease files / mumfordshah2d-0.5.2-cp39-abi3-win_amd64.whl
| Download URL | mumfordshah2d-0.5.2-cp39-abi3-win_amd64.whl |
|---|---|
| Size | 251.5 kB |
| Tags | CPython 3.9 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
925b22fac1f03f66550275f1a9f87ad63f6df9a5db691a41429248baef813e21
|
|
BLAKE2b-256 checksum How to use checksums |
91405b3e3839c966b2d7e901394fe0cd5ce9ae1b2ba6c984e197d96fe4325a0d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 11, 2026.
Transparency logRelease files / mumfordshah2d-0.5.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | mumfordshah2d-0.5.2-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 355.5 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
7a7ad4aad561be5e1c3486cdb664f472b762784272f1c9d340a6c67a1c4575f0
|
|
BLAKE2b-256 checksum How to use checksums |
5fbf2a11b83561cc8c2d61ac22d80bccaea04e4b91c5e2591a0db1e395543e4e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 11, 2026.
Transparency logRelease files / mumfordshah2d-0.5.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | mumfordshah2d-0.5.2-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 329.9 kB |
| Tags | CPython 3.9 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
03d551edd816c151ffdf2719d8aa350c0486c22aec60a719b6e4c178443553f5
|
|
BLAKE2b-256 checksum How to use checksums |
160878557a095135bdfcec4f1ad55f81c40247b7ead2095a0eef0ca10414a0cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 11, 2026.
Transparency logRelease files / mumfordshah2d-0.5.2-cp39-abi3-macosx_11_0_arm64.whl
| Download URL | mumfordshah2d-0.5.2-cp39-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 334.4 kB |
| Tags | CPython 3.9 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
b74d3c056d5af3db1c959aa084a44d9810338e33d274dc4de0c6fb284a2c2373
|
|
BLAKE2b-256 checksum How to use checksums |
ce5d5ede830e37e778a9f3de27187b8ac14cac4c11e3620a5059ed7a09a0fe55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 11, 2026.
Transparency logRelease files / mumfordshah2d-0.5.2-cp39-abi3-macosx_10_12_x86_64.whl
| Download URL | mumfordshah2d-0.5.2-cp39-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 346.6 kB |
| Tags | CPython 3.9 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
0dbb1f2103674b9b8e4b8eecd5d04c126f39e636a3c43eace62ebce49253ac06
|
|
BLAKE2b-256 checksum How to use checksums |
82f2e50bbf1fc6dedfda65f7c9f21eedb750c7f51d144db7d48417b0f18ffbbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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 May 11, 2026.
Transparency log