When Using the Discrete Wavelet transform using a Haar filter, i get negative values and the dynamic range goes up to well over 400
조회 수: 6 (최근 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!