Graphic STI
logo EPFL
Text EPFL
english only
Biomedical Imaging Group
IP-LAB: Image Processing Laboratories
BIG > Teaching > IP-LAB > Wavelets and Applications 19

Wavelets and Applications

1. Code the Haar Wavelet Transform (HWT)

We propose to study and implement the Haar wavelet transformation:

This transformation splits a discrete signal x of size m in the two parts y1 and y2, of size m/2 each.

1.1 Analysis

The analysis part of the HWT is implemented using 3 methods of the class HWT.

Diagram Analysis

The two methods analysis() are provided. Your assignment is to write the method split(). We assume that the size of the image is a multiple of 2n.

To get a better visualization of the wavelet coefficients, the plugin shows a second image with rescaled coefficients in every sub-band when only the "Analysis" is performed.

To test your work, use the plugin Haar Wavelet Transform on the image lighthouse for different numbers of scale, only ticking the "Analysis" checkbox in the dialog box. Fill the report.


Input image


Rescaled wavelet coefficients

1.2 Synthesis filter and implementation

Specify the synthesis filter (as a matrix) that reconstructs the input signal x from the two split parts y1 and y2 in one signal s such that s is equal to x.

Your assignment is to code the 3 methods that perform the inverse wavelet transform in the class HWT.

Test your work by applying a wavelet transformation and a subsequent inverse wavelet transformation on the image lighthouse (n=3) by ticking the checkboxes "Analysis" and "Synthesis".

1.3 Check the perfect reconstruction

Apply the Haar Wavelet Transform HWT(n) following by its inverse for n=1, 3, and 5 on the image lighthouse. Compute the SNR between the input image and the reconstructed image using the plugin SNR. Fill the report.

2. Code the Discrete Cosine Transform (DCT)

We propose to study and implement the discrete cosine transformation, which is defined by the basis functions shown below for a block [K, K]. The DCT is the transform used by JPEG compression when K=8. Here, we assume that the size of the images is a multiple of K.

The implementation is described at the pages 8-28 and 8.29 of the Image Processing course, in this case Ar = Ac = A. The algorithm transforms a block [K,K] of pixel values into a block [K,K] of DCT coefficients using the matrix A. The DCT part is implemented in the class DCT.

2.1 Analysis

The two methods analysis(ImageAccess in, int K) and analysis(ImageAccess block, double A[][]) are provided, but two other methods have to be implemented:

To get a better visualization of the DCT coefficients, the plugin shows a second image with rescaled coefficients in every patch when only the "Analysis" is performed.

To test your work, use the plugin Discrete Cosine Transform on the image lighthouse for different block sizes, only ticking the checkbox "Analysis" in the dialog box. Fill the report.


Input image


Rescaled DCT coefficients

2.2 Synthesis

The synthesis is similar to the analysis part, expect that the basis functions matrix is AT[K, K]. Your assignment is to implement the following 3 methods:

Test your work by applying a DCT and inverse by checking the boxes "Analysis" and "Synthesis".

2.3 Check the perfect reconstruction

Apply the discrete cosine transform DCT(K) following by its inverse for K=4, 8, and 32 on the image lighthouse. Compute the SNR between the input image and the reconstructed image using the plugin SNR. Fill the report.

3. Processing the wavelet coefficients

We propose to implement two simple processing strategies for the wavelet coefficients.

3.1 Hard threshold

Write a method doHardThreshold() that implements hard thresholding on the wavelet coefficients. The coefficients are stored into an ImageAccess object. This method also has to print the rate (percentage) of non-zero values (remaining coefficients) using the command IJ.log("Rate " + rate + "%");.

Apply your algorithm to the image ramp with the threshold value 25 using the plugin Hard Threshold. Plot the intensity profile on a horizontal line. Fill the report.

3.2 Soft threshold

Write a method doSoftThreshold() that implements soft thresholding on the wavelet coefficients. The coefficients are stored into an ImageAccess object.

Apply your algorithm to the image ramp with the threshold value 25 using the plugin SoftThreshold. Plot the intensity profile on a horizontal line. Fill the report.


Hard threshold Soft threshold

4. Denoising

Denoising is achieved by applying a soft threshold to the coefficients of the transform. Although better results could be obtained using other types of wavelet transform, as the Haar wavelet transform is somewhat rudimentary and the DCT is blocky for the present application, we still want to compare their respective performances in terms of denoising.

Find the optimal threshold

Experiment the denoising by adding noise (ImageJ menu → Process → Noise → Add Specified Noise) to the reference image lighthouse. The computation of the SNR (noiseless image, reconstructed image following noise addition) is performed using the plugin SNR.

For an additive noise of 10 and of 30, compute the SNR between the reference image and its noisy version; then, find the threshold Tden (+/-3) which gives the best SNR between the reference and the denoised images, for the transforms HWT(3) and DCT(8). Finally, using the computed optimal threshold value Tden, compute the SNR for HWT(2), HWT(3), HWT(6), HWT(8), DCT(4), DCT(8), DCT(32) and DCT(128). Fill the report.

5. Compression

Simple data compression is achieved by applying a hard threshold to the coefficients of the CDF 5/3 (Cohen-Daubechies-Feauveau) wavelet transform (used in JPEG2000) or the DCT (used in JPEG). Note that this is only a rudimentary form of compression. A true coder would further quantize the wavelet coefficients which induces additional errors. The resulting coefficient map would also need to be encoded efficiently using, for example, the EZW algorithm (embedded zero-tree wavelet coding).

Find the threshold Tcomp that retains 10% (+/- 3%) of the wavelet coefficients, using the image lighthouse, for the transforms HWT(3) and DCT(8). For this threshold Tcomp, give the SNR for HWT(2), HWT(3), HWT(6), HWT(8), DCT(4), DCT(8), DCT(32) and DCT(128). Fill the report.


webmaster.big@epfl.ch • 25.03.2019