Get 2D approximate wavelet coefficients

3 views (last 30 days)
David
David on 28 Aug 2011
Answered: Tanaya on 29 Apr 2014
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.

Answers (2)

Wayne King
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
  1 Comment
David
David on 28 Aug 2011
Hi, thanks for your answer Wayne.
That is the same i'm doing, but i need a vector with the coefficients not a matrix because i want to use it in a Support Vector Machine for classification.
Is not possible to obtain them from the vector 'c' given by wavedec2 command?
David.

Sign in to comment.


Tanaya
Tanaya on 29 Apr 2014
Hey. i want to display detail coefficients of type double.

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!