A list,

Total variation, also known as Total variation, is a common term used in image restoration. This paper briefly introduces the concept of total variation and its application in image denoising.

Total variational and denoising of one-dimensional signals

1.1 one dimensional continuous function of total variation One dimensional continuous real function f (x) f (x) in the range [a, b] ⊂ R [a, b] ⊂ R on the variational curve is defined as a parameter x – > f (x), x ∈ x [a, b] – > f (x), x ∈ [a, b] arc length. Its expression for Vba (f) = ∫ ba | ‘f (x) | dx Vab (f) = ∫ ab |’ f (x) | dx in plain English, the so-called “variation” is | (x + Δ x) – f f (x) | | (x + Δ x) – f f (x) |, for continuous function Δ x – > 0 Δ x – > 0. The total variation is for the interval defined by the function, which is the sum of the variances over the interval. Total variation of one-dimensional discrete signal From the total variation of continuous real function above, we can easily think of its discrete form. Signal sequence {yi}, I =1… N {yi}, I = 1,… , n, its total variation is defined as the V (y) = ∑ | I = 1 n + 1 – yi yi (y) = ∑ | V | I = 1 n + 1 – yi yi | summed up in one word, the whole variation is the sum of the absolute value of the difference between the item before and after.

1.2 One-dimensional signal denoising

When we get the observation signal Xixi, we want xixi to be smooth, that is, de-noising xixi. An intuitive idea is to make the total variation of the signal smaller. The physical meaning of total variation is the smoothness of the input signal. Let the obtained recovery signal be Yiyi, which should meet two conditions: there is not much difference between YiYI and observation signal Xixi. The common mathematical expression for this difference is that E(x,y)=12∑ I (xi−yi)2 E(x,y)=12∑ I (xi−yi)2 Yiyi is not a big total variation. Converting physical constraints into mathematical models and solving YY is equivalent to solving the following optimization problem:

MinyE (x,y)+λV(y) minyE(x,y)+λV(y) where the parameter λλ is a normal number, which is used to adjust the effect of the two constraints. Notice that E(x,y)E(x,y) and V(y)V(y) are both convex functions, and this is an unconstrained convex optimization problem that can be solved in many classical ways.

Total variation and denoising of two-dimensional discrete signals (images)

Image is a typical two-dimensional discrete signal, Rudin defined its total variation as

V (y) = ∑ I and j | yi + 1, j – yi, 2 + j | | yi, j + 1 – yi, j | 2 – – – – – – – – – – – – – – – – – – – – – – -) V (y) = ∑ I and j | yi + 1, j – yi, j 2 + | | yi, j + 1 – yi, j | 2 of this function is the gay, but not small, It’s not convex. The difficulty, speed and stability of non-convex functions are not as good as those of convex functions. So all the variation of two-dimensional another common definition of V (y) = ∑ I, j | yi + 1, j – yi, j | 2 – – – – – – – – – – + -) | yi, j + 1 – yi, j | 2 – – – – – – – – – – -) = ∑ I, j | yi + 1, j – yi, j + | | yi, j + 1 – yi, j | V (y) = ∑ I and j | yi + 1, j – yi, j 2 + | | yi, j + 1 – yi, j | 2 = ∑ I, j | yi + 1, j – yi, j + | | yi, j + 1 – yi, j | this function is convex function.

Image denoising based on total variation can be regarded as an optimization problem

MinyE lambda (x, y) + V (y) minyE lambda (x, y) + V (y) of E (x, y) E (x, y) as the data is defined as the error term

E(x,y)=12∑ I,j(xi,j−yi,j)2 E(x,y)=12∑ I,j(xi,j−yi,j)2 When VV has a convex function form, the problem becomes an unconstrained convex optimization problem, so it is easy to solve.

Ii. Source code

function [img_estimated,energyi,ISNRi,energyo,ISNRo]=tvmm_debluring(img_noisy,h,lambda,varargin)
% function   [img_estimated]=tvmm_debluring(img_noisy,h,lamdba,...
%            'optional_parameter_name1',value1,'optional_parameter_name2', value2,...) ; % % Total Variation-based image deconvolution with % a majorization-minimization approach. % % Written by: Joao Oliveira, Jose Bioucas-Dias, Mario Figueiredo % email: [email protected] % SITE: www.lx.it.pt/~jpaos/tvmm % Date:21/11/2005
%  
%        
% ========================== INPUT PARAMETERS (required) =================
% Parameter     Values
% name          and description
% ========================================================================
% img_noisy		(double) Noisy blured image of size ny. 
% h             (double) Blur kernel. % lambda Regularization parameter (which is multiplied by the % TV penalty). % % ========================  OPTIONAL INPUT PARAMETERS ==================== % Parameter Values % nameand description
% =======================================================================
% boa_iter      (double) The number of outer loop iterations. 
%               Default: 20 
% cg_iter       (double) The max number of inner CG iterations.
%               Default: 200
% soim_iter     (double) The max number of inner SOIM iterations.
%               Default: 20
% soim_cg_iter (double) The max number of CG iterations in inner SOIM.
%               Default: 6
% cg_thrld      (double) Conjugate Gradient threshold.
%               Default: 1e-5;
% image         (double) Original image.
% displayIm     ({'yes'.'no'}) if 'yes' is passed  the restored imaged
%               is displayed along the CG iterations
%               Default: 'no'
% info_energyi  ({'yes'.'no'}) if 'yes' is passed the isnr and energy of
%               the objective function is displayed inside the inner loop.
%               Default: 'no'
% info_energyo  ({'yes'.'no'}) if 'yes' is passed the energy of
%               the objective function is displayed at each outter loop.
%               Default: 'no'
% info_ISNRi    ({'yes'.'no'}) if 'yes' is passed the isnr is displayed.
%               Default: 'no'
%               Requires: image
% info_ISNRo    ({'yes'.'no'}) if 'yes' is passed the isnr is displayed.
%               Default: 'no'
%               Requires: image
% x_0           (double) initial image iteration.
%               Default: Wiener filter
% method        ({'cg'.'soim'}) Selects the method used to solve the linear
%               system: cg=conjugate gradient; soim=second order iterative
%               method.
%               Default: 'cg'
% l_min         (double) Minimum eigenvalue of the system for the second
%               order iterative method.
%               Default: 1e-5
% l_max         (double) Maximum eigenvalue of the system for the second
%               order iterative method.
%               Default: 1
% 
%       ===================================================================
%       The following functions can be provided in order to overwrite the 
%       internal ones. Recall that, by default. all calculations are % performed with circular convolutions. (see Technical Report) % =================================================================== % % mult_H (function_handle) Function handle to the function that % performes H*x. This function must accept two parameters: % x : image to apply the convolution kernel h % h : Blur kernel % mult_Ht (function_handle) Function handle to the function that % performes Ht*x (Ht = H transpose). This function must % accept two parameters: % x : image to apply the convolution kernel h % h : Blur kernel % diffh (function_handle) Function handle to the function that % computes the horizontal differences of an image x. % diffv (function_handle) Function handle to the function that % computes the vertical differences of an image x. % diffht (function_handle) Function handle to the function that % computes the horizontal differences (transposed) of  an % image x. % diffh (function_handle) Function handle to the function that % computes the vertical differences (transposed) of an % image x. % % % ====================== Output parameters =============================== % img_estimated Estimated image % energyi Energy of inner loop iterations. % Required input arguments:'info_energyi' and 'image'.
% ISNRi             Improvement Signal-to-noise ratio of inner loop iterations.
%                   Required input arguments: 'info_ISNRi' and 'image'.
% energyo           Energy of outer loop iterations.
%                   Required input arguments: 'info_energyo' and 'image'.
% ISNRo             Improvement Signal-to-noise ratio of outer loop iterations.
%                   Required input arguments: 'info_ISNRo' and 'image'.
%
% ============= EXAMPLES =========================================
% Normal use:
% [img_estimated]=tvmm_debluring(img_noisy,lambda,sigma)
% 
% Display restored images along CG iterations:
% [img_estimated]=tvmm_debluring(img_noisy,lambda,sigma,...
%                       'displayIm'.'yes')
%
% Perform ISNR calculations of the outer loop iterations:
% [img_estimated,energyi,ISNRi,energyo,ISNRo]=tvmm_debluring(img_noisy,...
%                       lambda,sigma,'info_SNRo'.'yes'.'image',image);
%

% ======================= DEFAULT PARAMETERS ===================
global mH mHt diffh diffv diffht diffvt
boa_iter = 20;          % Number of outer loop iterations
cg_iter = 200;          % Number of inner CG iterations
soim_iter = 20;          % Number of inner SOIM iterations
soim_cg_iter = 6;        % Number of CG iterations inside SOIM
cg_thrld = 1e-5;        % CG threshold
displayIm = 0;
image=[];
info_energyi='no';
info_energyo='no';
info_ISNRi='no';
info_ISNRo='no';
info_int = 0;
info_ext = 0;
energyi=0;
ISNRi=0;
energyo=0;
ISNRo=0;
mH=@conv2c;
mHt=@conv2c;
diffh=@f_diffh;
diffv=@f_diffv;
diffht=@f_diffht;
diffvt=@f_diffvt;
method='cg';
x_0=[];
l_min=1e-5;
l_max=1;
% ====================== INPUT PARAMETERS ========================
% Test for number of required parametres
if (nargin-length(varargin)) ~= 3
     error('Wrong number of required parameters');
end

% Read the optional parameters
if (rem(length(varargin),2) = =1)
    error('Optional parameters should always go by pairs');
else
    for i=1:2:(length(varargin)- 1)
        % change the value of parameter
        switch varargin{i}
            case 'boa_iter'                     % Outer loop iterations
                boa_iter = varargin{i+1};
            case 'cg_iter'                      % Inner loop iterations
                cg_iter = varargin{i+1};
            case 'soim_iter'                    % Inner loop iterations
                soim_iter = varargin{i+1};
            case 'soim_cg_iter'                 % CG iterations in Inner loop
                soim_cg_iter = varargin{i+1};
            case 'displayIm'                    % display sucessive xe estimates
                if (isequal(varargin{i+1},'yes'))
                    displayIm=1;
                end
            case 'cg_thrld'                     % CG threshold
                cg_thrld = varargin{i+1};
            case 'image'                        % Original image
                image = varargin{i+1};
            case 'info_ISNRi'                   % display ISNR inside inner loop
                info_ISNRi = varargin{i+1};
            case 'info_ISNRo'                   % display ISNR on outer loop
                info_ISNRo = varargin{i+1};
            case 'info_energyi'                 % display energy inside inner loop
                info_energyi = varargin{i+1};
            case 'info_energyo'                 % display energy on outer loop
                info_energyo = varargin{i+1};
            case 'x_0'                          % Initial image iteration
                x_0 = varargin{i+1};
            case 'mult_H'                       % Function handle to perform H*x
                mH = varargin{i+1};
            case 'mult_Ht'                      % Function handle to perform Ht*x
                mHt = varargin{i+1};
            case 'diffh'                   % External function to perform 
                diffh = varargin{i+1};     % horizontal differences    
            case 'diffv'                   % External function to perform 
                diffv = varargin{i+1};     % vertical differences    
            case 'diffht'                  % External function to perform 
                diffht = varargin{i+1};    % horizontal differences (transposed)   
            case 'diffvt'                  % External function to perform 
                diffvt = varargin{i+1};    % vertical differences (transposed)  
            case 'method'                  % External function to perform 
                method = varargin{i+1};    % vertical differences (transposed)  
            case 'l_min'                   % Minimum eigenvalue 
                l_min = varargin{i+1};       
            case 'l_max'                   % Maximum eigenvalue
                l_max = varargin{i+1};     
                
            otherwise
                % Hmmm, something wrong with the parameter string
                error(['Unrecognized parameter: ''' varargin{i} '' ' ']);
        end;
    end;
end
Copy the code

3. Operation results



Fourth, note

Version: 2014 a