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 个评论
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
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()
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Discrete Multiresolution Analysis 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!