Mumford-Shah edge-preserving image restoration — Python/Rust port of MATLAB/Java MumfordShah2D (Hohm, Storath & Weinmann)
Project description
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: Phase 1 alpha (0.1.0). The build, scaffolding, and small primitives (
Point,GaussElim/GaussL2Mum,Image, MATLAB utility ports, prox handles) are in place. The full 2D solver lands in Phase 4. SeePORTED_BY.mdfor the phasing plan.
Installation
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 .
Once Phase 5 ships, the package will be on PyPI as mumfordshah2d.
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mumfordshah2d-0.5.1.tar.gz.
File metadata
- Download URL: mumfordshah2d-0.5.1.tar.gz
- Upload date:
- Size: 15.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e7de1221554b13bb64226d71eb7c7fdcdb5dbb2540e2857416d34f853b8b188
|
|
| MD5 |
648355c05124118dd0681ff78c72035b
|
|
| BLAKE2b-256 |
13923ce4647796922e207ce648e44c8c235f292ae0ecf833f0490d902daefea0
|
Provenance
The following attestation bundles were made for mumfordshah2d-0.5.1.tar.gz:
Publisher:
release.yml on mstorath/MumfordShah2D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumfordshah2d-0.5.1.tar.gz -
Subject digest:
4e7de1221554b13bb64226d71eb7c7fdcdb5dbb2540e2857416d34f853b8b188 - Sigstore transparency entry: 1469382318
- Sigstore integration time:
-
Permalink:
mstorath/MumfordShah2D@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mumfordshah2d-0.5.1-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: mumfordshah2d-0.5.1-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 261.3 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d17cacba1b9c2443b2e5a894b9052eef87e9efebb8783e1af5f5239191c1e6e
|
|
| MD5 |
fb88d88175a2373c15dcdd11769372b0
|
|
| BLAKE2b-256 |
e77aef1e01e96872e94747ac1a3a2c6df74f1078417115c6db26027a1fddbabb
|
Provenance
The following attestation bundles were made for mumfordshah2d-0.5.1-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on mstorath/MumfordShah2D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumfordshah2d-0.5.1-cp39-abi3-win_amd64.whl -
Subject digest:
2d17cacba1b9c2443b2e5a894b9052eef87e9efebb8783e1af5f5239191c1e6e - Sigstore transparency entry: 1469383390
- Sigstore integration time:
-
Permalink:
mstorath/MumfordShah2D@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 355.7 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
efd5884ef8dd8bd787fcdab6c5857ea8f25261ef4e7cc2ad8493df1314ebc8c0
|
|
| MD5 |
00de3281c3912f12be830c3779e3a5fd
|
|
| BLAKE2b-256 |
72d3771422256815d7aeed32fb6634f4c78b8db46e0120ba85e28f126ff4cb29
|
Provenance
The following attestation bundles were made for mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on mstorath/MumfordShah2D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
efd5884ef8dd8bd787fcdab6c5857ea8f25261ef4e7cc2ad8493df1314ebc8c0 - Sigstore transparency entry: 1469382680
- Sigstore integration time:
-
Permalink:
mstorath/MumfordShah2D@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 335.1 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
52d52b1670c26f587dbc61479c473aeea010aa3251960f1fe87eb320e49eb6b6
|
|
| MD5 |
2e8b98da616569e0843a388cae56c067
|
|
| BLAKE2b-256 |
124f4101a53bd24fd4989b277c23aa5cb2ca555adfd18f5ac4502096673f9590
|
Provenance
The following attestation bundles were made for mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on mstorath/MumfordShah2D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumfordshah2d-0.5.1-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
52d52b1670c26f587dbc61479c473aeea010aa3251960f1fe87eb320e49eb6b6 - Sigstore transparency entry: 1469382493
- Sigstore integration time:
-
Permalink:
mstorath/MumfordShah2D@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mumfordshah2d-0.5.1-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: mumfordshah2d-0.5.1-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 334.2 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56a56f907cd1ed65b3b3f0901c715a27eadfeb65c2d8de4b9a93b992fbc004d8
|
|
| MD5 |
422849f57cdd35bebe613dae46fc9f61
|
|
| BLAKE2b-256 |
71f1aaf85dc56f5f17ff07ec21a6240d766886e07cda8ff268299425b92d8cfc
|
Provenance
The following attestation bundles were made for mumfordshah2d-0.5.1-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on mstorath/MumfordShah2D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumfordshah2d-0.5.1-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
56a56f907cd1ed65b3b3f0901c715a27eadfeb65c2d8de4b9a93b992fbc004d8 - Sigstore transparency entry: 1469382829
- Sigstore integration time:
-
Permalink:
mstorath/MumfordShah2D@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Trigger Event:
push
-
Statement type:
File details
Details for the file mumfordshah2d-0.5.1-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: mumfordshah2d-0.5.1-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 350.7 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50d450734184e5c2fa87624dbbf5d807cfbf188f6f19519c4be32a0c249b4d44
|
|
| MD5 |
0f0ac8df06b12af0429867dcaa1472a6
|
|
| BLAKE2b-256 |
d30de6e19b7020f732011b4945afed9e4ff5de0b9110246f2025034db1e9d5f2
|
Provenance
The following attestation bundles were made for mumfordshah2d-0.5.1-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on mstorath/MumfordShah2D
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mumfordshah2d-0.5.1-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
50d450734184e5c2fa87624dbbf5d807cfbf188f6f19519c4be32a0c249b4d44 - Sigstore transparency entry: 1469383059
- Sigstore integration time:
-
Permalink:
mstorath/MumfordShah2D@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Branch / Tag:
refs/tags/v0.5.1 - Owner: https://github.com/mstorath
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@13dbf70fed69e1507553e730b90d91ea535d3e0e -
Trigger Event:
push
-
Statement type: