Skip to main content

PDHG-based universal stripe-noise removal for images, backed by PyTorch

Project description

destripe

Universal stripe-noise removal for NumPy images. Decomposes an image into a TV-regularized clean component and directional ℓ²-penalized stripe components via a PDHG (primal-dual hybrid gradient) solver, backed by PyTorch.

Features

  • Removes vertical and diagonal stripe patterns (5 directions).
  • Preserves input dtype and value range (uint8, float32, float64).
  • Supports grayscale, single-channel, and RGB; color is preserved by estimating stripes on the luminance channel.
  • Tiled processing with cosine blending for large images that do not fit in memory.
  • Auto-selects CUDA when available; 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
)

Integer inputs are clipped to their dtype range on output.

Parameters

  • 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): max PDHG iterations. Early-stops on relative change below tol (default 1e-5), checked every 20 iterations.
  • tiles (default 1): n × n tiling with cosine-blended overlap. Use when the image does not fit in memory or stripes are locally non-stationary. overlap (default 64) sets blending width.
  • device (default None): "cpu", "cuda", a torch.device, or None to auto-select CUDA when available.
  • proj (default True): project the clean component onto [0, 1].

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.2.tar.gz (855.8 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.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file destripe-0.1.2.tar.gz.

File metadata

  • Download URL: destripe-0.1.2.tar.gz
  • Upload date:
  • Size: 855.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for destripe-0.1.2.tar.gz
Algorithm Hash digest
SHA256 197cce5757d74ac3e185b0a30cdd2adb8a54e1e916172a1a128d29307c5aa845
MD5 a7cf1d4d16fe6df0e5cad81b64de20cc
BLAKE2b-256 ff59b53e10fe5742e22228c098de8c221edcfb1485136bca71405e4681453786

See more details on using hashes here.

File details

Details for the file destripe-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: destripe-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for destripe-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 96395dd740c1ca23655f644d5ede741ae9100c76e1022596c2a69891271ad803
MD5 feb1b1f6aea4650c79153eac5a213d43
BLAKE2b-256 3408eed6ef84460c9ba0b6f2c347f7b09253c30f156b978a908e257a10d0dc39

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