Skip to main content

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 n tiled 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 (default 0.33): TV weight. Higher smooths more and removes stronger stripes; loses fine detail.
  • mu2 (default 0.003): ℓ² stripe penalty. Higher extracts stripes more eagerly; can leak real structure.
  • iterations (default 500): maximum PDHG iterations.
  • tol (default 1e-5): relative-change tolerance for early stopping, checked every 20 iterations.
  • tiles (default 1): number of tiles per side. Use values greater than 1 when the image does not fit in memory or stripes are locally non-stationary.
  • overlap (default 64): requested blend width in pixels. The solver clamps it to at most one quarter of each tile dimension.
  • device (default None): "cpu", "cuda", a torch.device, or None to auto-select CUDA when available.
  • proj (default True): project the normalized clean component onto [0, 1].
  • verbose (default False): 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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

destripe-0.1.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

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

Hashes for destripe-0.1.3.tar.gz
Algorithm Hash digest
SHA256 1db430869b72ca714b7de2a24dff21a0af1830f767951beae6f30ebba4272e04
MD5 190fe92d67cc0ab15340eecccec286c1
BLAKE2b-256 472c3d1851a9983b43b01909e3f894bfedd0a527b94d95a98658996261ec63f1

See more details on using hashes here.

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

Hashes for destripe-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4533794d5ea2a78d8088aea59fbc31a81ace3bd2550bffcddc1157fad17baf24
MD5 4676a28a9191aa68f05b44dabd807d29
BLAKE2b-256 59a00ef46e3410fd031c14d1c984cf5dde92b28baff4fc23d60f515106f64a75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page