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 dtype and value range: uint8, float32, float64 round-trip unchanged.
  • 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.1.tar.gz (855.1 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.1-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: destripe-0.1.1.tar.gz
  • Upload date:
  • Size: 855.1 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.1.tar.gz
Algorithm Hash digest
SHA256 da6721a7c0af5da8e3ae19c5fcf4dc879747f0a3689563c2a14cd77e22ab2405
MD5 2b6b425bc947031b2acd1817db5b7c70
BLAKE2b-256 c621b72f569108befa7567d1e01bb7776627f6c484ecce5d434a3618bf29a68f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: destripe-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d0bfe10bd8eda679295aa969e652b0e08df84137a09b3518ad0052f097407bc1
MD5 0423c565695f7ce4f437ad04fd5e1dcb
BLAKE2b-256 84c7e451f8c476acd8840fa8bdeddd1f0752362763fef75716e6df5c4430f1e6

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