help with matlab code
3 views (last 30 days)
Show older comments
hi everyone i'm very much new to matlab and need help. I have a 512*512 grayscale image. I need to find the second level dwt coefficients first and then need to find the standard deviation of the second level mid frequency coefficients.
i=imread('file.extension');
[c s]=wavedec2(i,2,'haar');
k=std(c);
is this code correct?
0 Comments
Accepted Answer
Wayne King
on 7 Feb 2012
Then from the line I gave you:
[H,V,D] = detcoef2('all',C,S,2);
std(reshape(V,size(V,1)*size(V,2),1))
std(reshape(H,size(H,1)*size(H,2),1))
More Answers (1)
Wayne King
on 7 Feb 2012
Hi Alma, You don't want std(c) because that gives you the standard deviation of all the wavelet and approximation coefficients.
You want:
x = randn(16,16);
[C,S] = wavedec2(x,2,'haar');
[H,V,D] = detcoef2('all',C,S,2);
Now you have to be clear on which wavelet coefficients you want the standard deviation of. I'm not clear on what you mean by "second level mid frequency" Do you mean highpass filtering followed by lowpass, or lowpass followed by highpass?
The diagonal details are obtained by highpass filtering the rows (followed by downsampling) and then highpass filtering the columns followed by downsampling.
The vertical details are obtained by highpass filtering the rows followed by lowpass filtering the columns. (with downsampling)
The horizontal details are obtained by lowpass filtering the rows and highpass filtering the columns (with downsampling)
See Also
Categories
Find more on Discrete Multiresolution Analysis in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!