When Using the Discrete Wavelet transform using a Haar filter, i get negative values and the dynamic range goes up to well over 400

7 次查看(过去 30 天)
I am currently using DWT2 and SWT2 to perform a wavelet transform using the Haar wavelet. How is it possible that the LL matrix contains negative values and values of 400, if the formula is basically an average of the odd and even coloumns/rows ?
  3 个评论
Daniel
Daniel 2014-2-7
Thank you for your reply. In the attachment you have the LL matrix of 256x256 Lena. The matrix was generated using the haar wavelet transform using the stationary wavelet transform of matlab.
Wayne King
Wayne King 2014-2-12
Hi Daniel, If I am going to be able to explain how the LL image from the DWT ends up producing certain values, I need the original data, not the LL matrix. Why don't you attach or send me that actual Lena image?

请先登录,再进行评论。

采纳的回答

Wayne King
Wayne King 2014-2-13
编辑:Wayne King 2014-2-13
Hi Daniel, I surprised you say that the LL image contains negative values. That I don't observe (nor would I expect it) for your data
im = imread('lena.bmp');
dwtmode('per')
[LL,LH,HL,HH] = dwt2(im,'haar');
isempty(find(LL<0))
You should get a 1 to indicate that there are no elements less than 0
Now to explain that you observe elements in the LL image with values larger than the original image.
Yes, that is expected. Here's why. With a 2-D separable wavelet transform you end up with a sum of averages in the LL image, so at a given element of the LL image you will have something like: 1/2(a+b)+1/2(a+b) = a+b
as a result you are likely to get elements up to twice in value of the original elements.
Here is a very simple example of that:
X = ones(4);
[LL,LH,HL,HH] = dwt2(X,'haar');
LL
You see the output LL image is [2 2; 2 2] where the elements are all of the form
1/2(1+1)+1/2(1+1)
Here is showing you exactly how that is obtained:
X = ones(4);
Lo_D = [1/sqrt(2) 1/sqrt(2)]; %Haar scaling filter
Y = conv2(X,Lo_D(:)','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',Lo_D(:)','valid'); % filter along the rows
Y = Y';
Y = Y(1:2:end,:) %downsample
Compare the Y matrix to the LL matrix obtained from dwt2()
  1 个评论
Daniel
Daniel 2014-5-20
编辑:Daniel 2014-5-21
Hi wayne. ive implemented this and it works than k you very much. in the inverse DWT, you have to use the same problem but instead of downsampling after convolution you have to upsample before convolution?
cheers :)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Multiresolution Analysis 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by