The reasons why we would want to smooth a digital image might be to remove noise, simplify the image or remove local variations that might become obstacles for further processing (like segmentation). When using a partial differential equation (PDE) to smooth an image, we consider the image a discretized function over its domain, and apply a time-dependent PDE that makes the image evolve timestep by timestep towards progressively simplified and smooth versions of itself. The limit of such a process is generally a image with a constant value everywhere; not a very interesting solution, but we usually stop the process long before this happens. All PDE's that we discuss here are on the form:
- Most of the information in this chapter is based on the doctoral thesis of D. Tschumperle and his 2006 paper Fast Anisotropic Smoothing of Multi-Valued Images using Curvature-Preserving PDE's. This page is no substitute for reading these papers. Rather, it is intended to give an overview that will prepare the reader on the topic so that it might become easier to absorb the material presented in these papers.
Here, represents the image, while represents an (image-dependent) smoothing term to be further specified.
The simplest smoothing schemes can be derived directly from a functional using the Euler-Lagrange equation. The functional in question gives a value that in some sense represents the amount of variation in the image, and the process of minimizing this functional leads to a gradual transformation of the original image into simplified versions of itself. We give here two examples:
This is perhaps the simplest case one can think of, and it leads to a smoothing process that is specified by the heat equation, and leads to linear diffusion. The functional that we aim to minimize is the squared image gradient norm integrated over the image domain :
Which, through the use of the Euler-Lagrange equation gives us the following PDE (the heat equation):
This smoothing process is isotropic; it smooths with equal strength in all spatial directions. This means that edges in the image will soon become blurred. In LSSEG, we can apply this smoothing scheme by calling the nonlinear_gauss_filter_XD() function and setting the parameter
p equal to zero.
This time, we depart from the following functional:
Example of progressive smoothing of an image using the heat equation
We see that it is somewhat similar to the integral in our last example, except that we have not squared the norm. This functional measures the total variation of the image, and the PDE we obtain from the Euler-Lagrange equation describes a process we call total variation flow. This process has several interesting theoretical properties; readers are refered to section 2.1.1 of Brox' thesis for an overview of these, and to section 2.3.2 to 2.3.4 of the same thesis for an examination of the resulting PDE. As for the previous example, the limit of the smoothing process is a constant image (and we will arrive there in finite time). However, the intermediate images are quite different. The edges in the image are well preserved for a long time, regions gradually merge with each other, and the intermediate images take on a segmentation-like appearance. The PDE system is:
In LSSEG, we can apply total variation flow on an image using the function nonlinear_gauss_filter_XD() with the parameter
p equal to 1.
However, smoothing PDEs are not limited to those obtained by the Euler-Lagrange equations on some functional. Although this kind of model has the teoretical benefit of reducing some explicitely defined criterion, it does not always have the effect on the image that we would like. In general, what we seek are schemes that, in a predictable way, smooth the image regions with different strength depending on the amount of local variation, and with different strength along the local image gradient and isophote directions. For this, we can make modified PDEs that no longer represent the gradient of some functional, and whose evolution does not lead to a minimization of some defined quantity, but which may in turn produce results that are tailored to our requirements.
If we have a look at the time-dependent evolution equation from the two examples above, we see that they both can be written on the general form:
Example of progressive smoothing of an image using total variation flow
with a scalar function that is 1 in the first example and in the second. Without departing from a functional, we can create customized schemes by specifying this function directly. What we want is to slow down diffusion in regions with high gradients (i.e., edges) while still allowing diffusion to take place at normal speed in "flat" regions. This idea was put forward by Perona and Malik in 1990, where they proposed the following choice of :
is here a fixed threshold that differentiates homogeneous regions from regions of contours. Tschumperle gives a good theoretical explanation of this in section 2.1.2 of his thesis, where he also shows that not only does this process lead to smoothing whose strength depend on the local gradient; it also smoothes with different strength (which can be explicitely determined) along the local image gradient and isophote.
We can go further, however. Above, is a scalar function that only depends on the image gradient norm. A more general formulation would be:
where is a tensor field defined on the domain and with values in the space of tensors described by positive-definite 2x2-matrices. (In case of three-dimensional images, i.e., volumes, we use instead of ). We call a field of diffusion tensors. Contrary to described above, depends not on the image gradient itself, but rather on the position in the image . Moreover, as is a tensor rather than a scalar, its effect on the smoothing term also varies with the local direction of (matrix-vector multiplication ). The smoothing at position will in general be strongest along the direction specified by the eigenvector with largest eigenvalue of , and weakest in the direction specified by the other eigenvector (which, due to the symmetry of the matrix, is perpendicular on the first). See the section on definition of a smoothing geometry for more on how the tensor field can be specified. For more on divergence-based PDEs, refer to section 2.1.4 of Tschumperle's thesis.
When expanding the expression on the right hand side of the equation above, the placement of inside the term leads to a term which depend on the derivative of . For this reason, we cannot in general say that the smoothing process locally follows the directions specified by the tensor field . D. Tschumperle shows that a more "predictable" process can be obtained by using the smoothing geometry in a trace-based formulation:
Here, is the smoothing geometry and is the local Hessian matrix of the image. For more details on this equation, and a discussion about how it differs from the divergence- based formulation, please refer to 2.1.5 and section 2.4.1 respectively of Tschumperle's PhD-thesis. In section 3.2.1 of the same thesis, Tschumperle shows that this equation has an analytical solution which is:
Where is the original image, is the image at time of the evolution process, and is a bivariate oriented Gaussian kernel:
The purpose of the tensor field referred to as the "smoothing geometry" is to define local smothing directions at each point in the image. Typically, in regular areas of the image, we want to smooth equally in all directions, whereas in regions with important gradients, it is important to smooth the image in a way that does not destroy the gradient, i.e., smooth much less along the gradient than in the direction perpendicular to it (the isophote direction). Thus, in order to define the smoothing geometry tensor field, we should, for each point in the image, define two directions (2D-vectors) and the smoothing strength along these who directions (scalars). In order to define these, we base ourselves on a smoothed version of the image's structure tensor. (The reason we smooth the structure tensor is to determine a gradient for each pixel that is somewhat less "local", thus representing structures in the image that go beyond the size of one pixel and also obtaining gradient estimates that are more robust against image noise).
For a given image point , the eigenvectors of the structure tensor represent the two privileged smoothing directions. Due to the smoothing of the structure tensor, we cannot directly refer to these eigenvectors as the gradient and isophote of the image at , but they are perpendicular and represent the direction along which the image varies the most (and thus were we should smooth little) and the direction along which the image varies the least (and thus where we should smooth more). The corresponding eigenvalues give information about strong the variation is. If the two eigenvalues are identical, then the image variation around this point is more or less the same in all directions, and the smoothing geometry should be isotropic here. If the two eigenvalues are different, we should smooth more along the direction with the smaller eigenvalue than along the direction with the bigger one, and the difference in smoothing strength (the anisotropy) should be reflected by the difference between these two values. If we name the two directions and , and choose two corresponding smoothing strenths and , the smoothing geometry matrix representation for a given image point becomes:
In LSSEG, we have a function called compute_smoothing_geometry_XD() that computes a smoothing geometry based on an image's structure tensor. Here, the two smoothing directions and are the eigenvectors of the structure tensor, and the corresponding smoothing strengths are taken to be:
where and are the two eigenvalues of the structure tensor corresponding to and respectively. This choice is discussed briefly in section 2.1 of [Tschumperle06]. Note that as long as , then the smoothing will be stronger along direction than along direction , and this difference will be more pronounced as the biggest eigenvalue (an thus the denominator of the fractions above) grows.
When smoothing images containing multiple channels, it is usually beneficial to smooth all image channels using the same smoothing geometry. If we smooth each image channel separately using a smoothing geometry computed independently of the other image channels, we risk ending up with an image where image edges are positioned differently in each channel, giving a undersirable blurred effect. Instead, we compute a common smoothing geometry based on the multi-channel definition of the image's structure tensor. This is covered in detail in section 2.2 of Tschumperle's PhD thesis.
We saw earlier that the trace-based formulation behaves locally as an oriented gaussian smoothing. The strength and orientation of this smoothing is directly reflected by the given structure tensor . This does a good job in preserving edges, but on curved structures, especially sharp corners, this leads to an undesirable rounding effect. The problem is that the gaussian kernel does not take curvatures into account. As a remedy, Tschumperle proposes an approach which can be seen as local filtering of the image with curved gaussian kernels . He develops the theory and algorithm in section 3 and 4 of his paper Fast Anisotropic Smoothing of Multi-Valued Images using Curvature-Preserving PDE's. In short, he splits the smoothing geometry tensor field into a sum of vector fields, and then performs line integral convolutions of the image with each of these vector fields and a univariate gaussian kernel function:
- Everything said above is directly generalizable to 3D-images (volumes), and LSSEG handles 2D and 3D smoothing in the same way.
is here the timestep used. In other words he carries out 1-dimensional convolutions of the image with along the streamlines defined by the vector fields obtained from .
In order to define vector fields along which to carry out line integral convolution, Tschumperle decompose the smoothing geometry in the following way:
where and is a tensor field that is the "square root" of , in the sense that . If , then .
Formally, the PDE that Tschumperle solves in the scheme proposed is:
where stands for the Jacobian of the vector field . However, the system is not solved using the "standard" method of discrete differencing on a regular grid. Instead, he demonstrates how this can be interpreted as a combination of 1D heat flows along the streamlines of the various vector fields .
We have implemented a 2D/3D version of the algorithm outlined above, which can be found in the example program app/smoothcurvpres.C that comes with LSSEG. Here, we will briefly present what is going on inside this implementation.
- First, the image is read from file. This can be a normal 2D image in any standard format, or alternatively a stack representing a 3D image. Stacks can be made with the program app/generate_stack.C
- Then we enter a loop on the number of timesteps used. Note that since we are using line integral convolution to compute the changes, each timestep can be arbitrarily large without affecting the stability (the nonlinearity will be affected, though).
- Depending on whether the image in question is 2D or 3D, the 2D/3D structure tensor is now computed. Note that the image has been blurred a little prior to this.
- Based on the structure tensor, the smoothing geometry is now computed, by a call to compute_smoothing_geometry_2D() or compute_smoothing_geometry_3D(), depending on whether the image is two or three dimensional.
- Now we carry out the splitting of the smoothing geometry tensor field into a sum of vector fields, and for each such field we carry out the actual line integral convolution.
- Finally, the result is displayed and, in case of 3D images, the result is saved as a stack to file.
- due to problems with the functions LIC_2D() and LIC_3D(), these are substituted with the less precise functions LIC_2D_FS() and LIC_3D_FS(). Read the note in the documentation of these function for an explanation.
image smoothed using our implementation of Tschumperle's algorithm. The parameters are the default ones, and the number of timesteps are 1, 4 and 8 (original image to the left)
Generated on Tue Nov 28 18:35:47 2006 for lsseg by