hi,i have a problerm in DWT
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hadeel
am 27 Okt. 2022
Kommentiert: Walter Roberson
am 28 Okt. 2022
hi,i try to transform the image into DWT and taking LL subband for processing,but i have a problem that LL subband views as a white region only,how i can solve this please??
[LL1,LH1,HL1,HH1]=dwt2(A,'db1');
figure(1)
subplot(2,2,1),imshow(LL1),title('LL');
subplot(2,2,2),imshow(LH1),title('Lh');
subplot(2,2,3),imshow(HL1),title('HL');
subplot(2,2,4),imshow(HH1),title('HH');
[LL2,LH2,HL2,HH2]=dwt2(LL1,'db1');
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 27 Okt. 2022
Your A matrix is probably uint8. Your LL1 returned from dwt() is double.
When you use that dwt() on data, the approximate maximum of the returned LL1 is twice the maximum value of the input. So with your input begin up to uint8(255), the approximate upper bound of LL1 is 510.0 . Notice that LL1 is double precision, and does not contain only values suitable for being uint8 .
So, you are trying to imshow() a double() number with values up to a little over 500.
When you are dealing with double() images, MATLAB assumes that all of the information is in the range 0.0 to 1.0 and that anything below 0.0 should be treated as 0, and anything about 1.0 should be treated as 1.0. It happens that the minimum LL1 value returned is greater than 1.0 so the data is displayed as-if it were all 1.0 -- all white.
You can use imshow(LL1, []) or imagesc(LL1) to have the graphics rescale the image data. But if you do that naively you lose any ability to compare between different images, because you would have removed any absolute scaling. You might want to specify a display range such as imshow(LL1, [0 512])
2 Kommentare
Walter Roberson
am 28 Okt. 2022
@Hadeel you would need to create a new kind of mathematical analysis of objects in order to get that. Wavelet analysis is defined to create half-sized matrices of approximation coefficients. Look at the algorithm section and notice the downsample by a factor of 2 built right into the algorithm.
If what you are trying to do is a wavelet approximation of an array, then you can dtw2() and then idtw2() . Or you can use wavedec2() and then waverec2()
See also https://www.mathworks.com/matlabcentral/answers/1810980-wcompress-for-1d-data#comment_2383455 in which I show how to use wavedec() and drop coefficients and then waverec() the reduced coefficients, thus producing an approximated matrix. In my tests, dropping one level of coefficients stil looked pretty good, dropping two levels of coefficients tended to look somewhat blocky, and dropping three levels of coefficients was typically unusable.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Discrete Multiresolution Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!