How the following code works in image denoising?
Show older comments
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};
end
wb = 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 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
y = x - lam*(ux + uy);
3 Comments
David Young
on 14 Aug 2015
Please format your code by removing the blank lines, selecting the code, and pressing the "{} Code" button. It will make it more readable.
D Joseph
on 14 Aug 2015
David Young
on 14 Aug 2015
I've edited the answer.
Accepted Answer
More Answers (0)
Categories
Find more on Neighborhood and Block Processing 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!