Matlab Code = Full variational image denoising method (total variation-based image denoising)Category: Total variation image denoising programming Code 2012-04-05 13:19 1196 people read reviews (0) Favorites report Image matlab reference Algor Ithm Input website
Reference
[1] L. Rudin, S. Osher, E. Fatemi, ' nonlinear total variation based noise removal algorithm ', Physica D 60 259-268, 1992.
related Website
[2] Total variation denoising:http://visl.technion.ac.il/~gilboa/pde-filt/tv_denoising.html
function J=tv (i,iter,dt,ep,lam,i0,c)
Percent Private FUNCTION:TV (by Guy Gilboa).
Percent total variation denoising.
EXAMPLE:J=TV (I,ITER,DT,EP,LAM,I0)
Percent INPUT:I-image (double array gray level 1-256),
Iter-num of iterations,
Percent Dt-time step [0.2],
Ep-epsilon (of gradient regularization) [1],
Percent lam-fidelity term lambda [0],
Percent I0-input (noisy) image [I0=i]
Percent (default values is in [])
Percent output:evolved image
If ~exist (' EP ')
Ep=1;
End
If ~exist (' DT ')
DT=EP/5; % DT below the CFL bound
End
If ~exist (' Lam ')
lam=0;
End
If ~exist (' I0 ')
I0=i;
End
If ~exist (' C ')
c=0;
End
[Ny,nx]=size (I); ep2=ep^2;
For i=1:iter, percent do iterations
% estimate derivatives
i_x = (I (:, [2:nx NX])-I (:, [1 1:nx-1]))/2;
I_y = (I ([2:ny NY],:)-I ([1 1:ny-1],:))/2;
I_xx = I (:, [2:nx NX]) +i (:, [1 1:nx-1]) -2*i;
I_yy = I ([2:ny NY],:) +i ([1 1:ny-1],:) -2*i;
Dp = I ([2:ny ny],[2:nx NX]) +i ([1 1:ny-1],[1 1:nx-1]);
Dm = I ([1 1:ny-1],[2:nx NX]) +i ([2:ny ny],[1 1:nx-1]);
I_xy = (DP-DM)/4;
% Compute Flow
Num = i_xx.* (ep2+i_y.^2) -2*i_x.*i_y.*i_xy+i_yy.* (ep2+i_x.^2);
Den = (ep2+i_x.^2+i_y.^2). ^ (3/2);
i_t = Num./den + lam.* (i0-i+c);
i=i+dt*i_t; Percent evolve image by DT
End% for I
Percent return image
%j=i*imean/mean (Mean (I)); % normalize to original mean