Denoising by Donoho algorithm

Hello I'm trying to apply Donoho formula on my noisy image to get the threshold value and apply it on details coefficients which i get it by using wavedec function please someone help me to get a results if some one have another idea for make my code useful please just tell me I'm waiting
clear all
I=imread('cameraman.tif');
n = prod( size(I) );
I=double(I);
Ib=I+25*randn(size(I));% add noise
[C,S] = wavedec2(Ib,2,'bior3.7');
DH = detcoef2('all',C,S,1);% extract details coefficient from level 1
delta = median( abs(DH) ) / 0.6745;
thr = delta * sqrt(2*log(n));
NC = wthcoef2('bior3.7',C,S,DH,thr,s) % i use the soft threshold
X = waverec2(C, S, 'bior3.7'); % how can i get my image after threshold
figure(2)
imagesc(X);axis off;colormap(gray)

 Risposta accettata

Wayne King
Wayne King il 15 Giu 2013
Modificato: Wayne King il 15 Giu 2013
You want to use the thresholded coefficients in the reconstruction. You also made a couple other errors in your code.
I = imread('cameraman.tif');
n = prod( size(I) );
I = double(I);
Ib = I+25*randn(size(I));% add noise
[C,S] = wavedec2(Ib,2,'bior3.7');
DH = detcoef2('all',C,S,1);% extract details coefficient from level 1
DH = DH(:);
delta = median( abs(DH) ) / 0.6745;
thr = delta * sqrt(2*log(n));
NC = wthcoef2('t',C,S,1,thr,'s'); % i use the soft threshold
X = waverec2(NC, S, 'bior3.7');
figure;
imagesc(Ib); title('Noisy Image'); colormap gray;
figure;
imagesc(X); title('Denoised 1st level coeffs'); colormap gray;

8 Commenti

Soum
Soum il 15 Giu 2013
yes Of course I should use the thresholded coefficients in recnstruction where are my errors ? can you fix them thank for response
Soum
Soum il 15 Giu 2013
Hi Mr Wayne King I've read your answer about my question please if you have the answer for my second question don't hesitate i need it so much thanks :/
Wayne King
Wayne King il 15 Giu 2013
I fixed your errors in my code above. If you copy and past the entire code fragment you'll see. You had an error in waverec2(), you had an error in your computation of the threshold, and you had an error in wthcoef2()
Soum
Soum il 15 Giu 2013
Modificato: Soum il 15 Giu 2013
Thank you Mr Wayne Just I want ask you I want to apply the threshold just on details coefficients :/ one more question wthcoef2('type',C,S,N,T,SORH) what does it mean type=t I've read how the instruction work but that type=h or v or d :/
That's what this line does:
NC = wthcoef2('t',C,S,1,thr,'s');
It applies soft thresholding to the level 1 detail coefficients.
Soum
Soum il 16 Giu 2013
THANK YOU AGAIN :) but you didn't understand me whatt does it mean the 't'??? NC = wthcoef2('t',C,S,1,thr,'s');
NC = wthcoef2('t',C,S,N,T,SORH) returns the detail coefficients obtained from the wavelet decomposition structure [C,S] by soft (if SORH ='s') or hard (if SORH ='h') thresholding (see wthresh for more information) defined in vectors N and T. N contains the detail levels to be thresholded and T the corresponding thresholds which are applied in the three detail orientations. N and T must be of the same length.
Soum
Soum il 25 Giu 2013
Thanks Mr.Walter Yes I've read this http://www.mathworks.com/help/wavelet/ref/wthcoef2.html but my Problem is why we put the t ???? t is a literal string but what does it mean ?

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by