Changing the dimensions of my matrix

Hi there
As you prob already know I am using the wavelet toolbox. I am attempting to perfrom the dwt2 on my signal which is 17x17x17 I have enetered the following code
[cA,cH,cV,cD]=dwt2(Adash,'bior2.4');
I then carry out some soft thresholding and attempt to convert these wavelet coefficients back into the original signal by using
Y = idwt2(cA,cH,cV,cD, 'bior2.4')
I wanted to ask two things; is this the correct way to go about things?
Also this method seems to be changing the dimensions of my matrix to 18x18x3?? Confused! Am I using the function in the correct way?

Answers (1)

There are better ways to implement this in the Wavelet Toolbox by using wdencmp for example.
If you want to do it your way by using dwt2 and idwt2, then try setting the dwtmode() to periodization first
dwtmode('per','nodisplay');
imdata = imread('ngc6543a.jpg');
[ca,ch,cv,cd] = dwt2(imdata,'db1','bior2.4');
Y = idwt2(ca,ch,cv,cd,'bior2.4');
isequal(size(Y),size(imdata))

3 Comments

Hi wayne! Thank you so much for your speedy response! :)
I have implemented the changes however I am getting a similar error message. OK so just to clarify I have used the following;
dwtmode('per','nodisplay'); tmp = fftn(MAT); Adash = fftshift(tmp); [cA,cH,cV,cD]=dwt2(Adash,'db1','bior2.4');
T = 0; cAT = wthresh(cA,'s',T); cHT = wthresh(cH, 's',T); cVT = wthresh(cV,'s',T); cDT = wthresh(cD,'s',T);
Awavenew = [cAT,cHT, cVT,cDT]; Awaveup = idwt2(cAT,cHT, cVT, cDT, 'bior2.4');
isequal(size(Awaveup),size(Adash));
Adashup=ifftshift(Awaveup);
Adashup2 = ifftn(Adashup);
L = find(ismember(Adashup2, A));
Diff = Adash - Adashup2;
As my signal is already an array I didnt used the imread function. I get the following error message then;
??? Array dimensions must match for binary array op.
Error in ==> part1reconstruct at 57 Diff = Adash - Adashup2;
Any ideas what it could be?/ Thanks so so much Wayne in advance for your help! :D
I'm confused by your use case. You're performing the DWT on the Fourier transform of the image data?
Hi there Wayne. Well I have a simulated signal and I have computed the fourier transform on it. And so I am now attempting to carry out the DWT on this data

Sign in to comment.

Categories

Find more on Wavelet Toolbox in Help Center and File Exchange

Products

Asked:

on 26 Mar 2013

Community Treasure Hunt

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

Start Hunting!