| Name: | Jonathan Bronson |
| Date: | Feb 24, 2010 |
Table of Contents |
|
Overview
The goal of this project is to implement and better understand the
work by Perona & Malik on Anistropic Diffusion. Their framework
shows that a small change to the heat equation or diffusion equation
can not only preserve edges in images, but often enhance them as well.
Further, we will see how a Nonlinear Scale-Space can be created to
better capture the structure of the image for segmentation.
Design Choices

One way to implement this is to convolve the image with a discrete laplacian kernel, and add the result back to the original image. This formulation can be solved directly at once, written out as:


What makes this formulation so powerful is the flux function dictates at what rate diffusion takes place at any given point in the field. For instance, using a flux function dependent on gradient magnitude allows us slow, or even halt diffusion along image edges. This creates a very robust image smoothing algorithm. Further, the flux function allows for what is physically impossible, inverse diffusion. The effect of such inverse diffusion is the enhancement or strengthening of edges. Perona and Malk suggested two possible flux functions:
|
and |
|
The first flux function (left) favors preserving edges, while the second function (right) favors smooth large regions. I've implemented both for this project, and it is clear which function to use is dependent on both the properties of the input image, as well as the desired output.
Implementing Anisotropic Diffusion can be done in a fashion similar to that of the isotropic case. It is slightly more complicated only because we cannot use the image laplacian directly, since each partial derivative is scaled by a different flux value. We can thus implement it as:

In this notation, the alphanumeric subscripts correspond to North, South, East and West pixels of the current location (i,j). This is convenient since the flux values are actually stored on edges, index notation would force us to denote them with half indices. Further, since we ultimately only care about the gradient magnitude, it makes no difference if we take the forward gradient or the backward gradient, as long as we are consistent.
Below is a comparison of three scale-spaces generated from an input image.
The first is standard Gaussian scale-space, created using isotropic diffusion.
The other two are created using anistropic diffusion with the two different
flux functions mentioned in the earlier sections. In addition, the gradient
maps of the varying image levels are shown for comparison.
For the two anisotropic scale-spaces, the flux functions took K = 0.4
| Scale | Linear | Quadratic | Exponential |
| t = 0 | ![]() |
![]() |
![]() |
| t = 1 | ![]() |
![]() |
![]() |
| t = 4 | ![]() |
![]() |
![]() |
| t = 16 | ![]() |
![]() |
![]() |
| t = 64 | ![]() |
![]() |
![]() |
| t = 256 | ![]() |
![]() |
![]() |
From the images alone, it is clear something very different is going on in the non-linear scale-space. First, the isotropic or Gaussian scale-space has no regards for boundaries within the image. This makes sense, as it assumes the least about the underlying image. The quadratic flux function takes into account gradient, but as Perona & Malik say, favors broad areas. This leads to a mild bleeding effect, not unlike water color paintings. Last, the the exponential flux function, which favors strong edges, blurs the least, while smoothing out regions of continuous texture. Looking at the gradient maps reveals more information.
| Scale | Linear | Quadratic | Exponential |
| t = 0 | ![]() |
![]() |
![]() |
| t = 1 | ![]() |
![]() |
![]() |
| t = 4 | ![]() |
![]() |
![]() |
| t = 16 | ![]() |
![]() |
![]() |
| t = 64 | ![]() |
![]() |
![]() |
| t = 256 | ![]() |
![]() |
![]() |
We can see from the gradient maps of each image how the different flux functions transform the input image through scale-space. Recall, the isotropic diffusion can be considered a constant flux function. With no regard for edge information, we see they disappear rapidly upward in scale-space. Not only does their magnitude fade, but they expand in width as well. Conversely, the quadratic and exponential flux functions have a different affect on edges.
First, edges of all types are preserved longer than in the isotropic case. Additionally, the stronger edges last longer, such that high level images retain only the most dominant edges. The effect appears more pronounced in the quadratic case simply because the flux function is more willing to smooth them out. For instance, in the top scale the quadratic function captures only the outline of the American flag, while the exponential function captures the inner lines as well.
The exponential flux function also has an additional side effect. Edges which were not strong in the input image, become more and more pronounced in the higher scales. In the images above, the most evident case of this is the edge between the clouds and sky.
![]() |
![]() |
![]() |
| Input Image | Quadratic K=0.08 t=64 | Exponential K=0.08 t=64 |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
| Input Image | Quadratic K=0.12 t=20 | Exponential K=0.15 t=20 |
![]() |
![]() |
![]() |
From the images above, it should be clear that the quadratic flux function and the exponential flux function suffer from opposite problems. The quadratic function nicely smooths out all shot noise, but blurs away all detail very quickly. The exponential function preserves better edge detail, but lacks the ability to remove the shot noise. In fact, some locations of noise get amplified as they are mistaken for strong edges. This fact is the motivation for the follow-up paper by Yu and Acten on Speckle Reducing Anisotropic Diffusion.
![]() |
![]() |
![]() |
![]() |
| Input Image | Quadratic K=0.035 t=64 |
Exponential K=0.035 t=64 |
Exponential K=0.15 t=64 |
![]() |
![]() |
![]() |
![]() |
The figures of the spine above show that for some images, the choice of flux function and K value are tightly related. The same K value will produce very different results between the Quadratic and Exponential functions. However, one can see that when we increase K substantially for the exponential function, the resulting image looks more like the result from the lower K-valued Quadratic function.
One way to improve the effectiveness of Anisotropic Diffusion would be to automatically obtain the ideal K values for the image. We could obtain such an ideal value by examining a histogram, or PDF of the image gradient. Then, we could choose a value corresponding to the perceived noise-edge ratio. A more advanced approach would be to identify various peaks in the PDF and choose multiple K values to segment varying levels of details in the image. It's clear from these results that even without such improvements, anisotropic diffusion is a powerful tool for image processing.