How to perform 2 level dwt using haar wavelet, without the haart() function?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I tried using the dwt2 function twice- first on original image and then on the LL subband obtained. However, this gives an incorrect result when the second decomposition results are obtained ( the first level seems fine) and I am not sure if it is conceptualy right either. The code is as below
%read and resize the original image
img=imread('download.jpg');
img=imresize(img,[256 256]);
%extract the R component from original image
red=img(:,:,1);
%creating zero matrix of size of original image
x=zeros(size(img,1),size(img,2));
%create matrices to display R component
or=cat(3,red,x,x);
%Applying first level of DWT on original R components
[LLor, LHor, HLor, HHor] = dwt2(im2double(or), 'haar');
%Applying second level of DWT on LL component original
[LLor2, LHor2, HLor2, HHor2] = dwt2(im2double(LLor), 'haar');
%displaying 2 level DWT results
figure,imshow([LLor2 LHor2; HLor2 HHor2], [])
Hence i used the wavedec2 function for multilevel decomposition, but then the resultant subbands I obtain are displayed as blank white image. The code I tried for it is what I got from https://in.mathworks.com/help/wavelet/ref/wavedec2.html
%Apply 2 level dwt on original
[co,so]=wavedec2(img,2,'haar');
[h1,v1,d1]=detcoef2('all',co,so,1);
a1=appcoef2(co,so,'haar',1);
v1img=wcodemat(v1,255,'mat',1);
[h2,v2,d2]=detcoef2('all',co,so,2);
a2=appcoef2(co,so,'haar',2);
v2img=wcodemat(v2,255,'mat',1);
figure,imshow(a1img)
figure,imshow(v1img)
I have tried searching for a solution online but to no avail. Also, I am new to matlab and image processing and hence may have overlooked some minute details. Any help would be greatly appreaciated. Thanks!
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre Image Analysis en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!