-2

I have problem how to make third level on an image in Matlab. I use this code:

image=imread('image.jpeg');
wavename = 'haar';
[cA,cH,cV,cD] = dwt2(im2double(image),wavename); %first level 
[cAA,cAH,cAV,cAD] = dwt2(cA,wavename); % Recompute Wavelet of Approximation Coefs.
Level2=[cAA,cAH; cAV,cAD]; %contacinat and second level
imshow([Level2,cH; cV,cD],'Colormap',gray);

[cAAA,cAAH,cAAV,cAAD] = dwt2(cAA,wavename); % Recompute Wavelet of Approximation Coefs.
Level3=[cAAA,cAAH;cAAV,cAAD]; %contacinat
imshow([Level3, cAH; cAV,cAD],'Colormap',gray); %3 level

But the program says that there is an error in the last row. The error is "CAT arguments dimensions are not consistent." So the question is how can i make this code to work?

1 Answers1

0

This is caused by your image, I assume.

The following code works properly, no changes made but the image

image=imread('cameraman.tif');
wavename = 'haar';
[cA,cH,cV,cD] = dwt2(im2double(image),wavename); %first level 
[cAA,cAH,cAV,cAD] = dwt2(cA,wavename); % Recompute Wavelet of Approximation Coefs.
Level2=[cAA,cAH; cAV,cAD]; %contacinat and second level
imshow([Level2,cH; cV,cD],'Colormap',gray);
figure
[cAAA,cAAH,cAAV,cAAD] = dwt2(cAA,wavename); % Recompute Wavelet of Approximation Coefs.
Level3=[cAAA,cAAH;cAAV,cAAD]; %contacinat
imshow([Level3, cAH; cAV,cAD],'Colormap',gray); %3 level
Ander Biguri
  • 35,140
  • 11
  • 74
  • 120