How to find the variance of the coefficients in each subband using Bayes Shrink method.
4 views (last 30 days)
Show older comments
I'm performing compression on an image using bayes shrink method. so i first added gaussian noise to my image and applied 2D discrete wavelet transform.
So I found the variance of the HH subband using the following Matlab code.
sigma=median(abs(cH))/0.6475;
But I cant square this value because it says it has to be a square matrix.
Next in order to find variances in each subband I'm stuck. I have to find a summation of all coefficients in the subband. But I'm not quite sure how to do this for greater than 1 level of decompostion. Please help with a sample code.
0 Comments
Accepted Answer
Walter Roberson
on 1 Mar 2012
You probably want
sigma.^2
You probably tried
sigma^2
which is sigma matrix-multiplied by sigma
0 Comments
More Answers (2)
bushra khan
on 10 Oct 2017
Edited: Walter Roberson
on 10 Oct 2017
N=1024;
L= 4;
t=0:1:N-1;
signal=wnoise(2,10);
figure;
snr=2;
y = awgn(signal,snr,'measured');
noisy = signal + y; %noisy signal
plot(t,noisy);
title('noisy signal');
[c,l] = wavedec(noisy,L,'db1'); %wavelet
A1 = appcoef(c,l,'db1');
d1 = detcoef(c,l,1);
sig=median(abs(d1))/0.6745;
ct=[];
for r = 1:L
cdr = detcoef(c,l,r); %detailed coefficients
sigy=var(cdr);
sigx=sigy-sig^2;
z=sqrt(sigx);
T=(sig^2)/sigx;
cdr=cdr-T; %soft thresholding
cdr(cdr<=T)=0;
ct=[cdr ct];
end
ct=[A1 ct];
X = waverec(ct,l,'db1');
figure;
%hold on
plot(X);
title('reconstruction using hard thresholding');
0 Comments
See Also
Categories
Find more on Denoising and Compression 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!