How to find the variance of the coefficients in each subband using Bayes Shrink method.
이전 댓글 표시
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.
채택된 답변
추가 답변 (2개)
bushra khan
2017년 10월 10일
편집: Walter Roberson
2017년 10월 10일
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');
카테고리
도움말 센터 및 File Exchange에서 Discrete Multiresolution Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!