% u = TVDENOISE(f,lambda) denoises the input image f. The smaller
% the parameter lambda, the stronger the denoising.
%
% The output u approximately minimizes the Rudin-Osher-Fatemi (ROF)
% denoising model
%
% Min TV(u) + lambda/2 || f - u ||^2_2,
% u
%
% where TV(u) is the total variation of u. If f is a color image (or any
% array where size(f,3) > 1), the vectorial TV model is used,
%
% Min VTV(u) + lambda/2 || f - u ||^2_2.
% u
%
% TVDENOISE(...,Tol) specifies the stopping tolerance (default 1e-2).
%
% The minimization is solved using Chambolle's method,
% A. Chambolle, "An Algorithm for Total Variation Minimization and
% Applications," J. Math. Imaging and Vision 20 (1-2): 89-97, 2004.
% When f is a color image, the minimization is solved by a generalization
% of Chambolle's method,
% X. Bresson and T.F. Chan, "Fast Minimization of the Vectorial Total
% Variation Norm and Applications to Color Image Processing", UCLA CAM
% Report 07-25.
%
% Example:
% f = double(imread('barbara-color.png'))/255;
% f = f + randn(size(f))*16/255;
% u = tvdenoise(f,12);
% subplot(1,2,1); imshow(f); title Input
% subplot(1,2,2); imshow(u); title Denoised
% Pascal Getreuer 2007-2008
1