Whiskey Delta
date created: 26/5/19 (DD/MM/YY)
This repository contains a Python implementation of image denoising using the Discrete Wavelet Transform (DWT) and the VISUShrink soft-thresholding algorithm.
The pipeline adds Gaussian white noise to an image, applies brightness and contrast enhancement, performs wavelet decomposition, applies thresholding to selected coefficients, and reconstructs a denoised image via inverse wavelet transform.
Let the noisy image be represented as:
I_noisy(x, y) = I(x, y) + n(x, y)
where n(x, y) is additive Gaussian white noise.
The 2D DWT decomposes the image into four subbands:
- LL: Approximation (low-frequency components)
- LH: Vertical detail
- HL: Horizontal detail
- HH: Diagonal detail
This implementation uses:
pywt.dwt2()
The VISUShrink method applies soft-thresholding using a universal threshold:
T = σ √(2 log N)
where:
- σ is the estimated noise standard deviation
- N is the number of pixels
Soft-thresholding is defined as:
ŵ = sign(w) · max(|w| − T, 0)
Thresholding is applied to selected wavelet subbands to suppress noise while preserving structural information.
The denoised image is reconstructed using:
pywt.idwt()
The image is then resized back to its original dimensions.
- Add Gaussian White Noise (GAWN)
- Apply Brightness and Contrast Enhancement
- Perform 2D Wavelet Decomposition
- Compute VISUShrink Threshold
- Apply Soft Thresholding
- Reconstruct via Inverse Wavelet Transform
- Resize to Original Dimensions
- Save Output Image
- Gaussian white noise simulation
- Brightness and contrast scaling
- Wavelet-based multiresolution analysis
- VISUShrink soft-thresholding
- Configurable wavelet basis (default: db4)
- Automatic image reconstruction and saving
- Python 3.8+
- NumPy
- OpenCV
- PyWavelets
Install dependencies with:
pip install numpy opencv-python pywavelets
Place the input image (default: DSC8.JPG) in the project directory.
Run the script:
python wavelet_denoising.py
The program will prompt for:
- Contrast scaling factor (alpha) between 1.00 and 3.00
- Brightness scaling factor (beta) between 0 and 100
After execution:
- A corrupted image is displayed
- The denoised image is saved as: denoised.jpg
wavelet_denoising(img, wavelet=pywt.Wavelet('db4'))
img: Input grayscale image as a NumPy arraywavelet: PyWavelets basis (default: Daubechies-4)
The script produces:
- A noise-corrupted intermediate image
- A denoised reconstructed image (
denoised.jpg)
- Single-level wavelet decomposition
- Thresholding applied only to LL and HH subbands
- Designed for grayscale images
- Noise model assumes additive Gaussian noise
- No quantitative metrics (PSNR/SSIM) included