Get 2D approximate wavelet coefficients
3 views (last 30 days)
Show older comments
Hi, i need to get 2D approximate wavelet coefficients from an image. I've read all the documentation about but there is still one thing i can't understand. I do the following:
I get 2D coefficients and the bookeeping matrix:
[c,s]=wavedec2(image,2,'db4');
size(c)
s
ans =
1 46153
s =
61 52
61 52
115 97
224 187
so, if i'm not wrong i'm getting 46153 wavelet coefficients on vector 'c' organized as:
C = [ A(N) | H(N) | V(N) | D(N) | ... H(N-1) | V(N-1) | D(N-1) | ... | H(1) | V(1) | D(1) ]
so i want to get A(N) which are approximate coefficients of level 2 but i don't know which is the de size of A(N) because of the first row of the bookeeping matrix (s) tells me that the size approximate coefficients of level 2 is a matrix of 61x52 according to what i get if i type:
coeffs=appcoef2(C,S,'db4',s);
but i don't understand completly that because according to the documentation the bookeeping matrix tells me that the number of coefficients should be:
62x51=3162 approximate coefficients of level 2
62x51=3162 detail coefficients of level 2
115x97=11155 detail coefficients of level 1
which makes a total of 17479 and not 46153.
Summarizing, i need approximate coefficients in a vector (not a matrix) and i'm not sure how doing this.
Any help or explanation would be great.
Thanks, David.
0 Comments
Answers (2)
Wayne King
on 28 Aug 2011
Hi, If you want the approximation coefficients at level 2
load woman
[C,S] = wavedec2(X,3,'db2');
A2 = appcoef2(C,S,'db2',2);
imagesc(A2);
colormap gray;
Wayne
See Also
Categories
Find more on Discrete Multiresolution Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!