Implementation of DWT/ SWT on image using MATLAB

Implementation of Discrete wavelet transform (DWT) and Stationary wavelet transform (SWT) on an image using MATLAB

1. In Matlab, for DWT and SWT there is already predefined in-built function i.e. dwt2/idwt2 and swt2/iswt2 respectively.
2. The implementation of these two concepts on an image is almost similar.
3. This tutorial will explain the implementation of DWT (dwt2/idwt2) on an image. Similarly, the function swt2/iswt2 can be applied in same way in Matlab.


Step 1: Read Image
a) The step 1 uses imread( ) function to import the image that needs processing and is stored in the variable name i.e. x.

Step 2: Decomposition

[A1,H1,V1,D1] = dwt2(x,'db2');
a) The above step decomposes the image x at level 1 using db2 wavelet family into four components i.e. approximate part (A), horizontal part (H), vertical part (V) and diagonal part (D). 

b) If you want to further decompose the image to next level 2, then you have to again apply dwt2 on A1 using below steps.
[A2,H2,V2,D2] = dwt2(A1,'db2');
The above code further decomposes the A1 into A2, H2, V2, and D2. This way the decomposition goes on to next level.

Step 3: Processing of wavelet coefficients

a) After decomposition, the image x is decomposed into various wavelet coefficients.
b) Now the author can process/ filter these wavelet coefficients using any filtering method such as thresholding, diffusion etc. as per their requirement.
c) Let say, [A2,H2,V2,D2] are filtered and enhanced/ stored as [AA2,HH2,VV2,DD2].
Similarly [A1,H1,V1,D1] are filtered and enhanced/ stored as [AA1,HH1,VV1,DD1].

Step 4: Inverse Decomposition (Important part)

X2 = idwt2(AA2,HH2,VV2,DD2,'db2');    //  AA2,HH2,VV2, and DD2 reconstructs to X2.
X1 = idwt2(X2,HH1,VV1,DD1,'db2');      //  X2,HH1,VV1,and DD1 reconstructs to X1.
a) The final image is restored using idwt2 function that is used for an inverse decomposition.

Step 5: Show final image

X1 is the final restored image.

For more image processing topics refer:
Implementation of DWT/ SWT on image using MATLAB Implementation of DWT/ SWT on image using MATLAB Reviewed by Dr. Prabhishek Singh on April 18, 2020 Rating: 5

No comments:

Powered by Blogger.