wow#
- sunkit_image.enhance.wow(data, *, scaling_function=None, n_scales=None, weights=None, whitening=True, denoise_coefficients=None, noise=None, bilateral=None, bilateral_scaling=False, soft_threshold=True, preserve_variance=False, gamma=3.2, gamma_min=None, gamma_max=None, h=0)[source]#
Processes an image with the Wavelets Optimized Whitening (WOW) algorithm.
This function manipulates the wavelet spectrum of the input image so that the power in the output image is equal at all locations and all spatial scales, thus “whitening” the wavelet spectrum. By doing so, the large scale structures are attenuated and the small scale structures are reinforced, with the objective criterion that the variance at all scales must be equal. The algorithm has the added advantage to allow attenuation of the noise at the same time, thus avoiding the usual explosion of noise usually inherent to enhancement methods.
Note
The filter was developed with the intention to find an objective criterion for enhancement. By default, there are therefore no free parameters to adjust, except for the denoising coefficients. It is however possible to set the synthesis weights to be values other than 1 to tune the output. It is also possible to merge the output with a gamma-scaled version of the original image. The weight of the gamma scaled image can be adjusted using the parameter
h
, to the type of input image (e.g., wavelength or channel). For most purposes, the weights can be set to be equal for all scales.We do not deal with NaN (Not a Number) in this implementation.
- Parameters:
data (
numpy.ndarray
orsunpy.map.GenericMap
) – Image to be transformed.scaling_function ({
Triangle
,B3spline
}, optional) – The wavelet scaling function, comes from thewatroo
package. Defaults toB3spline
.n_scales (
int
, optional) – Number of scales used for the wavelet transform. IfNone
, the number of scales is computed to be the maximum compatible with the size of the input. Defaults to None.weights (
list
offloat
, optional) – Optional reconstruction weights used in the synthesis stage. By default, the weights are all set to 1. If the weights are not 1, the spectrum of the output is not white. Defaults to[]
.whitening (
bool
) – If True (default), the spectrum is whitened, i.e., normalized to the local power at each scale. Defaults toTrue
.denoise_coefficients (
list
offloat
, optional) – Noise threshold, in units of the noise standard deviation, used at each scale to denoise the wavelet coefficients. Defaults to[]
.noise (
numpy.ndarray
orNone
, optional) – A map of the noise standard deviation, of same shape as the input data. This can be used to take into account spatially dependent (i.e., Poisson) noise. Defaults toNone
.bilateral (
int
orNone
, optional) – Uses bilateral convolution to form an edge-aware wavelet transform. The bilateral transform avoids the formation of glows near strong gradients. The recommended “natural” value is 1. Defaults toNone
.bilateral_scaling (
bool
, optional) – Experimental, do not use. Defaults toFalse
soft_threshold (
bool
, optional) – Used only if denoise_coefficients is not[]
. IfTrue
, soft thresholding is used for denoising, otherwise, hard thresholding is used. Soft thresholding tends to create less artifacts. Defaults toTrue
.preserve_variance (
bool
, optional) – Experimental, do not use. Defaults toFalse
.gamma (
float
, optional) – The value used to calculate the global gamma-transformed image. Defaults to 3.2.gamma_min (
float
orNone
, optional) – Minimum input to the gamma transform. IfNone
, defaults to minimum value ofdata
.gamma_max (
float
or None, optional) – Maximum input to the gamma transform. If None, defaults to maximum value ofdata
.h (
float
, optional) – Weight of the gamma-scaled image wrt that of the filtered image. Defaults to 0.
- Returns:
numpy.ndarray
orsunpy.map.GenericMap
– Normalized image. If a map is input, a map is returned with new data and the same metadata.
References
Frédéric Auchère, Elie Soubrié, Gabriel Pelouze, Eric Buchlin, 2023, “Image Enhancement with Wavelets Optimized Whitening.”, Astronomy & Astrophysics, 670, A66 doi:10.1051/0004-6361/202245345