Get 2D approximate wavelet coefficients

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.

回答 (2 件)

Wayne King
Wayne King 2011 年 8 月 28 日

0 投票

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 件のコメント

David
David 2011 年 8 月 28 日
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.

サインインしてコメントする。

Tanaya
Tanaya 2014 年 4 月 29 日

0 投票

Hey. i want to display detail coefficients of type double.

カテゴリ

ヘルプ センター および File ExchangeAI for Signals and Images についてさらに検索

質問済み:

2011 年 8 月 28 日

回答済み:

2014 年 4 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by