function [y] = EADTV(x,lam,alp,costheta,sintheta,varargin)% Input parameters
% x : noisy image
% lam : lambda parameter in the functional
% alp : length of the major axis of the ellipse
% costheta, sintheta :
% varargin : number of iterations (default = 100)
% Output : y : minimizer of the functional above
% filters for realizing the Delta operator and its transpose
h=[1 -1];g = h(end:-1:1);% [-1 1]
R = (costheta + 1i*sintheta);%%%===&&&(((
kappa = alp.^(-2);kappa = kappa/(8*lam^2);vx = zeros(size(x)); % vx and vy hold the vector fields
vy = zeros(size(x));if isempty(varargin), % number of default iterations
MAX_ITER = 100;else MAX_ITER = varargin{1};endwb = waitbar(0,'Please wait,calculating the EADTV...');for iter = 1:MAX_ITER, waitbar(iter/MAX_ITER,wb) % apply 'A' to v (see eq 13 for the definition of A)
ux = alp*vx; % apply alpha
uy = vy; u = R.*(ux + 1i*uy); % apply R
ux = conv2(real(u),g); ux = ux(:,1:end-1); % apply Delta
uy = conv2(imag(u),g'); uy = uy(1:end-1,:); % subtract from x
u = x - lam*(ux + uy); % now apply A'
ux = conv2(u,h); ux = ux(:,2:end); uy = conv2(u,h'); uy = uy(2:end,:); u = lam*conj(R).*(ux + 1i*uy); vx = vx + kappa*real(u)*alp; vy = vy + kappa*imag(u); % now apply the threshold
m = abs(vx + 1i*vy); ind = (m > 10^(-10)); m = max(1,m); % m = max(10^(-10),m); % for stability
vx(ind) = vx(ind)./m(ind); vy(ind) = vy(ind)./m(ind); end close(wb);% compute A*v
vx = alp*vx; % apply Lambda
u = R.*(vx + 1i*vy); % apply Rux = conv2(real(u),g); ux = ux(:,1:end-1); % apply Deltauy = conv2(imag(u),g'); uy = uy(1:end-1,:);% subtract from xy = x - lam*(ux + uy);
MATLAB: How the following code works in image denoising
MATLAB
Best Answer