PDHG-based universal stripe-noise removal for images, backed by PyTorch
Project description
destripe
PDHG-based stripe-noise removal for NumPy images, backed by PyTorch. The solver decomposes an image into a TV-regularized clean component and directional ℓ²-penalized stripe components.
Features
- Removes vertical and diagonal stripe patterns with five directional components.
- Accepts grayscale
(H, W), single-channel(H, W, 1), and RGB(H, W, 3)arrays. - Preserves input shape and dtype; integer outputs are clipped to their dtype range.
- For RGB inputs, estimates stripes on Rec. 601 luminance and subtracts them from each channel.
- Supports
n x ntiled processing with cosine-blended overlap for large images. - Uses CUDA when available if
device=None; otherwise falls back to CPU.
Install
pip install destripe
Quick Start
from destripe import destripe
image = ... # numpy.ndarray, shape [H, W] or [H, W, 3]
clean = destripe(
image,
mu1=0.33,
mu2=0.003,
iterations=500,
tiles=1, # >1 for n x n tiled processing
device="cpu", # "cpu", "cuda", or None to auto-select
)
Parameters
image: numeric NumPy-compatible array with shape(H, W),(H, W, 1), or(H, W, 3).mu1(default0.33): TV weight. Higher smooths more and removes stronger stripes; loses fine detail.mu2(default0.003): ℓ² stripe penalty. Higher extracts stripes more eagerly; can leak real structure.iterations(default500): maximum PDHG iterations.tol(default1e-5): relative-change tolerance for early stopping, checked every 20 iterations.tiles(default1): number of tiles per side. Use values greater than1when the image does not fit in memory or stripes are locally non-stationary.overlap(default64): requested blend width in pixels. The solver clamps it to at most one quarter of each tile dimension.device(defaultNone):"cpu","cuda", atorch.device, orNoneto auto-select CUDA when available.proj(defaultTrue): project the normalized clean component onto[0, 1].verbose(defaultFalse): print iteration progress.
Suggested mu Pairs
- Conservative / subtle stripes:
[0.1, 0.001],[0.1, 0.0017] - Light, thin stripes:
[0.17, 0.003],[0.23, 0.003] - Typical to strong stripes:
[0.33, 0.003],[0.4, 0.007] - Severe corruption / short stripes:
[0.5, 0.017]
Starting points, not universal optima.
Reference
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
destripe-0.1.3.tar.gz
(856.3 kB
view details)
Built Distribution
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 destripe-0.1.3.tar.gz.
File metadata
- Download URL: destripe-0.1.3.tar.gz
- Upload date:
- Size: 856.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1db430869b72ca714b7de2a24dff21a0af1830f767951beae6f30ebba4272e04
|
|
| MD5 |
190fe92d67cc0ab15340eecccec286c1
|
|
| BLAKE2b-256 |
472c3d1851a9983b43b01909e3f894bfedd0a527b94d95a98658996261ec63f1
|
File details
Details for the file destripe-0.1.3-py3-none-any.whl.
File metadata
- Download URL: destripe-0.1.3-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4533794d5ea2a78d8088aea59fbc31a81ace3bd2550bffcddc1157fad17baf24
|
|
| MD5 |
4676a28a9191aa68f05b44dabd807d29
|
|
| BLAKE2b-256 |
59a00ef46e3410fd031c14d1c984cf5dde92b28baff4fc23d60f515106f64a75
|