8. Variational Priors and Regularization

Painting detail by Louis Peyré (1923–2012). About the paintings.
Variational methods reconstruct images by balancing agreement with measured data against a penalty describing expected image structure. The choice of penalty controls the tradeoff between noise removal and preservation of sharp edges. Starting from Sobolev and total variation energies, we develop their discrete operators, derive the associated diffusion flows, and compare stopping a flow early with minimizing an energy that includes a data fidelity term.
8.1 Sobolev and Total Variation Priors¶
The simplest priors integrate local differential quantities over the image domain. They measure smoothness through seminorms on function spaces. We study two widely used examples: the Sobolev and total variation priors.
8.1.1 Continuous Priors¶
In this section we define priors for functions on a continuous domain. Section 8.1.2 develops their counterparts for discrete images .
Sobolev prior.
A prior energy assigns small values to images in the target class and larger values, possibly , to images that depart from that model. The smoothness classes described in Section 5.2.1 motivate Sobolev priors. The simplest such energy is
where is the distributional gradient and the integral is over . The energy is one half of the squared seminorm and vanishes on constant functions. We set it to when the gradient is not square integrable.
Total variation prior.
To accommodate discontinuities in images, we use the total variation energy introduced in Section 5.2.3. Rudin, Osher, and Fatemi introduced its use in image denoising [28].
The total variation of a smooth image is defined as
This energy extends to functions of bounded variation , which may be discontinuous. This class includes indicator functions of sets with finite perimeter .
The total variation seminorm can also be computed using the coarea formula (5.12), which shows in particular that .
8.1.2 Discrete Priors¶
An acquisition device discretizes a continuous-domain image into a pixel array . To process these data, we need priors defined on finite-dimensional image spaces.
Discrete gradient.
Discrete Sobolev and total variation priors use finite-difference approximations to derivatives. For example, the forward differences are
where the image has pixels and . Higher-order schemes give more accurate approximations for smooth functions. Boundary conditions require care. For simplicity, we use periodic boundary conditions, computing the indices modulo . Symmetric boundary conditions can also be used to avoid boundary artifacts.
With the grid-spacing factor absorbed into the energy scaling, the discrete gradient at each pixel is
and the gradient operator maps images to vector fields:
Figure 8.1 shows discrete gradient vectors approximating the local direction of steepest intensity increase. Figure 8.2 displays the signed gradient components and their Euclidean magnitude. A shared nonlinear display curve enhances weak red and blue components without changing the numerical gradient. Large magnitudes indicate rapid intensity variations, typically at edges or in textured regions.
Figure 8.1. Discrete gradient vectors.
Discrete divergence.
One can also use backward differences,
The adjoint relation between backward and forward differences is
which means that
This is the discrete counterpart of integration by parts,
for smooth periodic functions on .
We define the discrete divergence using backward differences:
This operator maps vector fields to images:
It is the negative adjoint of the gradient:
which means that
This identity is a discrete version of the divergence theorem.
Figure 8.2. Discrete gradient of the flower image. Red and blue encode the signed horizontal and vertical components with enhanced display contrast; neutral gray represents zero. The last panel shows the Euclidean gradient magnitude.
Discrete Laplacian.
The Laplacian is the divergence of the gradient:
This operator is negative semidefinite because .
With the discrete gradient and divergence defined above, the Laplacian is the local high-pass filter
which, after scaling by the grid spacing, approximates the continuous Laplacian:
Laplacian operators thus act as filters. With the Fourier convention , the continuous Laplacian is diagonal in the Fourier domain:
while the discrete Laplacian (8.3) has Fourier representation
Discrete energies.
The discrete Sobolev energy is one half of the squared norm of the gradient field:
The isotropic discrete TV energy instead sums the Euclidean magnitudes of the gradient vectors:
Here the notation for a vector field means
where .
8.2 PDE and Energy Minimization¶
Minimizing a smooth prior by gradient descent produces an image-smoothing flow.
8.2.1 General Flows¶
The gradient of a differentiable prior is the vector that describes its local first-order variation:
Gradient descent seeks to decrease a smooth discrete energy by iterating
where the step size is chosen to ensure descent. The quadratic and smoothed TV energies below admit explicit sufficient bounds on .
To pass to continuous time, associate iteration with time and let tend to zero. The limiting flow
satisfies the following differential equation, an ODE for a finite-dimensional image and a PDE when space is continuous:
Gradient descent is an explicit time discretization of this differential equation at times .
Figure 8.3. Heat flow (top) and TV flow (bottom): images at increasing times .
8.2.2 Heat Flow¶
Heat flow results from applying (8.9) to the Sobolev energy , defined in (8.1) for functions and in (8.5) for discrete images.
Expanding the quadratic energy gives
so that
Figure 8.4, left, shows an image Laplacian. Its magnitude is typically large near edges, with either sign.
The heat flow is thus
Figure 8.4. Discrete Laplacian (left) and negative discrete TV gradient (right).
Continuous in space.
For continuous images on the unbounded domain , the PDE (8.10) has an explicit solution: convolution with a Gaussian kernel whose variance grows with time
Convolution with this widening kernel progressively smooths the image.
Discrete in space.
The gradient flow of the discrete Sobolev energy (8.5) is
Discretizing time as in (8.8) gives the fully discrete iteration
where denotes the four neighbors of pixel . Each iteration convolves the current image with the same filter:
The filter has coefficients and ; all other entries vanish.
This iteration is stable and converges if .
8.2.3 Total Variation Flows¶
Total variation gradient.
The total variation energy is nonsmooth, both in its continuous form (8.2) and in its discrete form (8.6). In the discrete case, is nondifferentiable at any image with a pixel where .
If at every pixel, the gradient is
The displayed quotient is undefined where the spatial gradient vanishes. Figure 8.4, right, shows the negative TV gradient; normalization by small gradient magnitudes makes it sensitive to perturbations in smooth regions.
Nondifferentiability prevents the use of classical gradient descent at such images. A TV flow can nevertheless be defined through the subgradient inclusion . Here we first study a smooth approximation.
Regularized total variation.
To obtain a differentiable energy, we smooth the TV prior as follows:
where controls the smoothing. Figure 8.5 illustrates the corresponding smoothing of the absolute value function.
Figure 8.5. Regularized absolute value .
The smoothed TV energy has gradient
This smoothing interpolates between TV and a rescaled Sobolev energy. For fixed ,
Figure 8.6 displays the regularized spatial-gradient magnitude for several smoothing parameters.
Figure 8.6. Regularized gradient norm .
Regularized total variation flow.
The smoothed total variation flow is then defined as
Choosing a small makes the flow approximate total variation minimization more closely, but requires smaller time steps in explicit discretizations.
In practice, gradient descent (8.8) discretizes this flow in time. For the smoothed total variation flow to converge, a sufficient condition is . Thus, a closer approximation to the TV energy requires smaller time steps and more iterations.
Figure 8.3 compares heat flow with smoothed TV flow for a small . TV flow preserves edges better than heat diffusion, consistent with the ability of the TV energy to represent sharp transitions.
8.2.4 PDE Flows for Denoising¶
PDE flows can be used to remove noise from an observation . As detailed in Section 7.1.2, a simple noise model assumes that each pixel is corrupted by Gaussian noise , and that these perturbations are independent (white noise).
To denoise, we initialize the PDE flow at the observed image at time :
Stopping the flow defines an estimator , whose quality depends on the stopping time . Figure 8.7 illustrates denoising by Sobolev and TV flows.
Figure 8.7. Denoised images at several times : Sobolev flow (top) and TV flow (bottom).
On a connected periodic grid, converges to a constant image when , so the choice of balances noise removal against excessive smoothing of image edges. Selecting this stopping time is often difficult. In simulations, if one has access to the clean image , one can monitor the denoising error and choose the that minimizes this error. Figure 8.8, top row, shows reconstructions obtained with such an oracle choice of stopping time.
8.3 Regularization for Denoising¶
The flow-based approach in Section 8.2.4 defines the estimator by choosing a stopping time. Alternatively, we can define it as the minimizer of an objective that balances data fidelity and a prior. This formulation also accommodates nonsmooth priors such as total variation and sparsity . Chapter 9 extends it to general inverse problems.
Figure 8.8. Denoising using PDE flows and regularization.
Figure 8.9. SNR as a function of time for flows (top) and for regularization (bottom).
8.3.1 Regularization¶
For a noisy image with pixels and a prior , consider
where the regularization parameter balances the data fidelity term against the penalty .
If a clean reference image is available, one can choose the parameter by minimizing the denoising error . Such a reference is rarely available in practice, so parameter selection must account for the noise level and the regularity of the unknown image .
For a proper lower semicontinuous convex prior , the quadratic fidelity makes the objective strongly convex, so it has a unique minimizer. For nonconvex priors, minimizers need not be unique; properness, lower semicontinuity, and a lower bound for suffice for existence.
The resulting estimator is
with chosen according to the noise level and prior.
For a differentiable convex prior , gradient descent for (8.15) takes the form
where is chosen according to the smoothness of the objective. The iteration adds a data fidelity force to the time-discretized flow (8.8), counteracting the prior’s tendency to smooth the image toward a constant.
Total variation and the sparsity prior are nondifferentiable; the ideal sparsity prior is also nonconvex. Classical gradient descent therefore cannot be applied directly to (8.15). Computing then requires smoothing the prior or using algorithms adapted to nonsmooth objectives, as developed later in the book.
8.3.2 Sobolev Regularization¶
The discrete Sobolev prior defined in (8.5) is differentiable, and the gradient descent (8.16) reads
Since is quadratic, one can also solve the associated linear system by conjugate gradients.
The solution has the explicit linear-system representation
Thus, for this prior, the estimator defined by (8.15) depends linearly on the observations .
If the differential operators are computed with periodic boundary conditions, this linear system can be solved exactly in the Fourier domain
where is determined by the discrete Laplacian; see (8.4).
Equation (8.17) shows that denoising using Sobolev regularization corresponds to low-pass filtering with strength controlled by . Compare this with the solution (8.11) of the heat equation, which uses a Gaussian low-pass kernel with variance in each coordinate.
Sobolev denoising belongs to the class of linear estimators studied in Section 7.2. Choosing is therefore a filter-selection problem, as in Section 7.2.2, restricted here to a one-parameter family.
8.3.3 TV Regularization¶
The total variation prior in (8.6) is nondifferentiable. We can either smooth it or use an algorithm designed for nonsmooth optimization.
The approximation defined in (8.12) is differentiable in . Substituting its gradient (8.13) into (8.16) gives
For , these iterates converge to the unique minimizer of (8.15) with .
Section 19.5.1 presents an algorithm for the original nonsmooth TV penalty.