How to implement LH, HL, HH in DWT of an image ?
Show older comments
I want to implement the subbands without using the built in functions in Matlab
I have calcaluted the LL only but don't know what should be changed to calculate LH, HL, HH subbands
what I have reached so far..
X=double(imread('image.jpg'));
[row,col]=size(X);
Scale_filter = [1/sqrt(2) 1/sqrt(2)]; %Haar scaling filter
Y = conv2(X,Scale_filter(:)','valid'); %filter along the columns
Y(:,end+1) = Y(:,end); % periodically extend the matrix for the next step
Y = Y(:,2:2:end); % downsample along the columns
Y(end+1,:) = Y(end,:); %periodically extend the rows for the next step
Y = conv2(Y',Scale_filter(:)','valid'); % filter along the rows
Y = Y';
Y = Y(1:2:end,:) %downsample
Answers (1)
Dev
on 27 Feb 2025
In the code provided above, the Haar wavelet low-pass filter is already computed as ‘Scale_filter’. We also need to compute the high-pass filter to eventually compute the LH, HL and the HH sub-bands. Please refer to the code snippet below as a reference to generate a Haar wavelet high-pass filter-
% High-pass filter
Wavelet_filter = [-1/sqrt(2) 1/sqrt(2)];
After computing the same, we can apply the appropriate convolutions of low-pass and high-pass filters along rows and columns according to the type of filter required. Please refer to a brief overview of the appropriate convolutions below. You can try them in accordance with your code to implement the remaining sub-bands-
- LH: Low-pass filter on columns, high-pass filter on rows.
- HL: High-pass filter on columns, low-pass filter on rows.
- HH: High-pass filter on both rows and columns.
The remaining steps of downsampling and periodic extension in the code provided can be kept the same while implementing these filters.
I hope the above resolve your query.
Categories
Find more on Denoising and Compression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!