issue with coefficients of Discrete wavelet transform
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Please why am I getting 1 x 10517 as the result of coefficient exported to the workspace after using Discrete Wavelet Transform. The coefficient is too big to be used as feature vector or am I doing it wrongly? Someone please help me out
0 commentaires
Réponses (1)
Wayne King
le 27 Jan 2013
Modifié(e) : Wayne King
le 27 Jan 2013
That is the entire vector of wavelet coefficients for the image down to the level you have specified. To create useful wavelet feature vectors you only use a subset of those coefficients.
If you are using the 2D DWT, then see wavedec2 for an explanation of which coefficients correspond to which subbands.
For example, let's say for your application, the diagonal detail coefficients at level 1 were deemed to be the most important and you also wanted the approximation coefficients at level 5.
load woman;
dwtmode('per','nodisplay')
% decomposition down to level 5
[C,S] = wavedec2(X,5,'bior3.5');
Consulting the help for wavedec2, we see that
app5 = C(1:prod(S(1,:)));
diag1 = C(end-prod(S(6,:))+1:end);
Give the coefficients you want to use.
Alternatively, and probably easier, is to use appcoef2 and detcoef2 to extract the desired coefficients at the desired level.
D1 = detcoef2('d',C,S,1);
A5 = appcoef2(C,S,'bior3.5',5);
The above are matrices, so if you want a vector, you can use reshape()
D1 = reshape(D1,prod(size(D1)),1);
A5 = reshape(A5,prod(size(A5)),1);
Voir également
Catégories
En savoir plus sur Wavelet Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!