Trouble with LL in DWT2

2 vues (au cours des 30 derniers jours)
Jagadeesh p
Jagadeesh p le 29 Fév 2012
After performing DWT
y=imread('lena.jpg');
x=rgb2gray(y);
[LL,LH,HL,HH]=dwt2(x,'haar');
figure(1),imshow(uint8(LL));
Image at LL is not same as output shown in matlab "wavelet tool box" after performing 1-level dwt
Not same Indicates: My output image looks brighter than matlab "wavelet tool box"
Pls help

Réponses (8)

Wayne King
Wayne King le 29 Fév 2012
Hi Jagdeesh, you're not giving us enough to go on. The classic Lena image is not included in the Wavelet Toolbox as far as I am aware.
dwt2.m is a file in the Wavelet Toolbox, so I'm not sure what you mean that the output is not the same as shown in the Wavelet Toolbox.
Also, an image appearing "brighter" can just be a matter of colormap (scaling) so I think you need to be much clearer in your explanation of how you are viewing this image in the Wavelet Toolbox.
  1 commentaire
Jagadeesh p
Jagadeesh p le 1 Mar 2012
the following web page contains image at LL from my prog.
<https://picasaweb.google.com/109865487447441986686/MATLAB?authkey=Gv1sRgCOba9uSMzIuGAw#5714778369192972562>
where as in net it shows the image like this
LOOK AT PAGE-34 LENA image
<http://www.scribd.com/doc/53270811/19/Two-Dimensional-Discrete-Wavelet-Transform>
I hope u can observe difference b/w the two
PlS HELP ME :):)

Connectez-vous pour commenter.


Wayne King
Wayne King le 1 Mar 2012
That looks like just a colormap (display) problem to me. But you do not provide the Lena file and you do not show your MATLAB commands. Please put your file somewhere and show your MATLAB commands.

Jagadeesh p
Jagadeesh p le 1 Mar 2012
y=imread('lena.jpg');
x=rgb2gray(y);
[LL,LH,HL,HH]=dwt2(x,'haar');
figure(1),imshow(uint8(LL));

UJJWAL
UJJWAL le 1 Mar 2012
Hi,
The problem is with your understanding of the Wavelet Theory. The yy which you are showing is basically the approximation matrix of the Lena Image. It is not the same as the original image. When you reconstruct that is upsampling and all through MRA using the approximation matrix and all the detail matrix (corresponding to horizontal , vertical and diagonal directions) then only you would get the original image.
In Wavelet toolbox , the output image is the reconstructed image while in ur code you are displaying the approximation image only. Hence your output is a brighter version of the original image. There is no problem with the program or the toolbox or the colormap. The problem is basically a conceptual one.
Hope this helps Happy to help UJJWAL

Wayne King
Wayne King le 1 Mar 2012
Why are you converting back to uint8 and then using imshow:
y=imread('lena.jpg');
x=rgb2gray(y);
[LL,LH,HL,HH]=dwt2(x,'haar');
imagesc(LL); colormap gray;
  2 commentaires
UJJWAL
UJJWAL le 1 Mar 2012
converting back to uint8 is important to bring the data to the same type as the input data. Imagesc is just scaling the data to the full range of the colormap.
Moreover , the output data ( in wavelet toolbox) will definitely be different from this because here he has not carried out the reconstruction but instead is displaying only the approximation matrix while the toolbox will give the reconstructed image
Wayne King
Wayne King le 1 Mar 2012
The poster does not indicate that he is concerned about maintaining data type. He only indicates that he has trouble seeing agreement between his output and the output displayed in some document.
Also, the image the OP points to on p.34 of the document is an image of the level-1 scaling coefficients not a reconstruction. My impression was that he just thought the output of imshow() looks brighter than the display of the LL image in his document.

Connectez-vous pour commenter.


Jagadeesh p
Jagadeesh p le 2 Mar 2012
hey Ujjwal
The image which i have reffered and my o/p image both are approxiamation image. It's definetly not reconstructed one.
If u need more calrification look at below link
Hope u can understand problem and suggest me a better solution

Jagadeesh p
Jagadeesh p le 2 Mar 2012
hey wayne
use wavemenu command to load an image.
because difference in type original image is "uint8" and after dwt2 image is "double". u need to definetly convert uint8 otherwise u get a "white image wit 2 spots on it".
Pls see the difference and suggest me a better solution

UJJWAL
UJJWAL le 2 Mar 2012
Hi, Jagdeesh,
Ok. Now I understand. Previously i was thinking that maybe you are referring to the idwt image of the toolbox. My bad.
Actually the reason which i now realise is that , you are trying to plot the matrix LL which is the approximation matrix. However it contains many values outside the range of the colormap (like there are many values exceeding 255). Due to this when you directly imshow, those are sealed off to 255 and hence you see a considerably brighter image.
To solve this problem you will have to scale the data values so as to bring the values into the colormap of grayscale(that is 0 to 255). for that use imagesc function. The image will now be displayed properly

Catégories

En savoir plus sur Discrete Multiresolution Analysis dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by