# image compression versus image denoising

Wavelet based image denoising may be performed by thresholding (selecting a threshold value, and discarding all values below the threshold. Wavelet-based image compression may also be performed by a similar way. What is the difference then between the two operations? can we consider denoising a certain type of compression? Discarding in case of denoising means removing the coefficients below the threshold, while in compression all values below the threshold are set to zero? why setting the values to zero reduces the entropy? they are not removed, and if the image is transmitted across a wireless channel, the zero values are coded and transmitted.

• Indeed, your sentences "Wavelet based image denoising may be performed by thresholding" and "Wavelet-based image denoising may also be performed by a similar way" are both refering to denoising, not compression. Which one could be recast to compression? – Laurent Duval Dec 14 '19 at 18:33

Perceptually lossless (but actually lossy) image compression aims to maintain visually the same image while reducing the number of bits necessary to represent it. If you try to compress aggressively however, visually apparent compression artifacts will show up.

Wavelet based image denoising aims to change the appearance of an image by getting rid of what is considered as noise. We expect the denoised image to look better, compared to the noisy version.

One side effect of image denoising is also a reduction in the size of the image, as you are effectievely discarding some data from the image. But it will never be as efficient as a compression algorithm.

Furthermore, since noise is always considered as irrelevant information, it can be useful to denoise an image (if necessary) before compressing it, allowing you to achieve higher compression rations.

However, note that image denoisers are not perfect algorithms in terms of discriminating noise from true image data, and they may and will discard not only noise but also some very critical image information (especially at high frequencies, textures an edges).

• How is compression is done based on thresholding? Is it done by discarding the values below the threshold? or by setting to zero the value below the threshold? – Noha Dec 15 '19 at 6:28
• Coefficient Thresholding during compression relies on the (theoretically reasonable) emprically observed statistically averaged typical image transform coefficient characterisation. It tells us that low & mid detail coefficients are large in magnitude and detail coefficients (that are hard to see) are typically small in magnitude. Hence if you apply a properly adjusted quantization and thresholding on those coefficients, you will be discarding (by setting to zero) many coefficients while visually maintaining the same image perceprion, hence getting a reduction in image data size. – Fat32 Dec 15 '19 at 13:26
• why setting the coefficients below the thrshold to zero reduces the data size? – Noha Dec 15 '19 at 18:32
• Setting the coefficients to zero doesn't mean removing them. Then how can this leads to a reduction in data size? – Noha Dec 15 '19 at 18:34
• Entroopy of the noise reduced image is less than the noisy image. Hence potentially it's compressed. You have to find a suitable means of actually reducing it. – Fat32 Dec 15 '19 at 19:48

compression = reduction of bits necessary.

So, if it does that, it's compression. If not, it's not compression.

By itself, it's not clear what you mean with "discarding"; if you mean "set to zero", that's not reducing the amount of bits; if you mean "discarding" in the sense of "assuming they are zero by definition and not storing/transporting these coefficients", that's compression.

Also, setting a lot of coefficients to zero can make entropy coding (e.g. Huffmann) work better, but again, that's an extra step.

So, this boils down to: you need to define what discarding means to you, and then you'll see it clearly.

• What I know is that discrete wavelet transform (DWT) compacts the energy of the signal into small number of DWT coefficients having large amplitudes, and spreads the energy of the noise over a large number of DWT coefficients having small amplitudes. Hence, a thresholding operation attenuates noise energy by removing those small coefficients while retaining signal energy by keeping these large coefficients unchanged.Removing of course means reduction of bits, so what is the difference between compression and denoising? @ Marcus Müller – Noha Dec 15 '19 at 6:15
• literally the first five words of my answer. – Marcus Müller Dec 15 '19 at 10:47
• Do you mean that denoising by thresholding can be a form of compression, since reduction of bits occur? – Noha Dec 15 '19 at 12:51

Compression can be (under some conditions) a type of denoising. The converse is less evident. Because while denoising "only" needs to keep meaningful information, compression requires to pack it efficiently (which requires clever bit-level management).

The question is a priori more generic on the data side: not only on images, it also relates to strings, signals, videos, point clouds, meshes, or less structured data in general. It is also more generic in the processing side: how can one "transform data into a domain where useful information can be either separated from noise or compressed"?

This discussion is related to the following classical hypotheses (yet rarely stated):

1. data we acquire possess structured information that could be distinguished from more random stuff (noise),
2. some processing can tell one from the other.

Designing optimization criteria for these hypotheses is complicated, because they seem to require a lot of background information on what data is, and what noise is. However, following progresses in the 90's, a paper provided (at least to me) a groundbreaking cleavage: deterministic data can be compressed, noise not (my words). The paper is: Filtering Random Noise from Deterministic Signals via Data Compression, B. K. Natarajan, IEEE Transactions on Signal Processing, 1995.

We present a novel technique for the design of filters for random noise, leading to a class of filters called Occam filters. The essence of the technique is that when a lossy data compression algorithm is applied to a noisy signal with the allowed loss set equal to the noise strength, the loss and the noise tend to cancel rather than add. We give two illustrative applications of the technique to univariate signals. We also prove asymptotic convergence bounds on the effectiveness of Occam filters

Occam here refers to William of Ockham, to whom is attributed the law of economy, or principle of parsimony, now known as the sparsity condition. It promotes models/decomposition/features that are sparser (easier to describe) that the data itself. Balas K. Natarajan is also the author of the influential 1995 paper: Sparse Approximate Solutions to Linear Systems.

With wavelets, and especially the notion of non-linear approximation, it became more natural to project (noisy) data onto sets of vectors (bases, frames), with coefficients such that the higher in magnitude were the most important. The coefficients with the lowest magnitude were deemed noisy. If we can easily set a threshold between low and high coefficients, the job is done. Since the data is structured, and the noise is more random, we can hope that transformations on data can improve the gap or span between data coefficients and noise coefficients in magnitude. This is what dwells behind sparsification.

To be more concrete: when a sine is buried in heavy noise (to the naked eye), a Fourier transform can extract a single peak above the frequency noise floor, as the energy of the sine concentrates on only one frequency, and the uncoherent noise remains scattered across all frequencies. In that respect, Fourier sparsifies noisy sines.

Since a lot of useful signals (locally smooth, bumpy or wiggling) can be seen as piecewise regular, some wavelets are not so bad at providing a sparse or a compressible representation of them. In other words, a few coefficients in a judicious basis or frame can closely reproduce the original data. This was exemplified in: Adaptive wavelet thresholding for image denoising and compression, Chang, S. G. and Yu, B. and Vetterli, M., 2000, IEEE transactions on Image Processing:

The first part of this paper proposes an adaptive, data-driven threshold for image denoising via wavelet soft-thresholding. The threshold is derived in a Bayesian framework, and the prior used on the wavelet coefficients is the generalized Gaussian distribution (GGD) widely used in image processing applications. The proposed threshold is simple and closed-form, and it is adaptive to each subband because it depends on data-driven estimates of the parameters. Experimental results show that the proposed method, called BayesShrink, is typically within 5% of the MSE of the best soft-thresholding benchmark with the image assumed known. It also outperforms SureShrink (Donoho and Johnstone 1994, 1995; Donoho 1995) most of the time. The second part of the paper attempts to further validate claims that lossy compression can be used for denoising. The BayesShrink threshold can aid in the parameter selection of a coder designed with the intention of denoising, and thus achieving simultaneous denoising and compression. Specifically, the zero-zone in the quantization step of compression is analogous to the threshold value in the thresholding function. The remaining coder design parameters are chosen based on a criterion derived from Rissanen's minimum description length (MDL) principle. Experiments show that this compression method does indeed remove noise significantly, especially for large noise power. However, it introduces quantization noise and should be used only if bitrate were an additional concern to denoising.

Keeping the highest coefficients from a wavelet basis or frame can be efficient to denoise images. I usually call that "concentration" or "condensation" of the data into a subset of values. But to go beyond that for compression, here is a catch. To REALLY compress, we also need to:

• record the 2D spatial location of the kept wavelet coefficients, which can triple the storage need for a coefficient (because you story the value above the threshold, and the two $$(x,y)$$ coordinates)
• keep only the necessary bits, which is related to quantization
• use the residual redundancy on the thresholded/quantized coefficients and locations, which is called coding or encoding.

Hence, image denoising does not really compress. But an image compression algorithm (like JPEG 2000), which quantizes values in a magnitude order, and stops at some appropriate level, can actually denoise data that contains noise (noisy images, seismic data, engine experiments in my experience).

So the counter-intuitive statement is: if the data is structured and somewhat noisy, careful compression can indeed denoise it.