Sunday, December 4, 2011

Anisotropic diffusion is awesome

We know that the heat equation diffuses an image isotropically. This is not good, because it destroys the edges too.  Somehow one must find a way for isotropic diffusion, only in a flat region and stop the diffusion near the edges. This is the motivation for Peitro Perona and Jitendra Malik's original formulation of anisotropic diffusion.

The heat equation is $\frac{\partial u}{\partial t}=\Delta u$ i.e. $\frac{\partial u}{\partial t}=\mbox{div}\,(\nabla u)$ with $u(0)=f$.

The idea behind the anisotropic diffusion is to multiply the gradient by a function g that equals 1 when the $\nabla u=0$ i.e. flat regions and goes to 0 as the gradient increases, i.e. near the edges. A typical function that works is $g(x)=\frac{1}{1+(x/b)^2}$. for some constant $b$.

That is $\frac{\partial u}{\partial t}= \mbox{div}\,(g(\Vert\nabla u \Vert^2) \nabla u)$.

Alternatively, this can also be viewed as the gradient descent for the minimization of the energy
$$E(u):=\frac{1}{2}\int_{\Omega} g(\Vert\nabla u\Vert^2).$$
Let us look at some experiments, now.


Here is an experiment with Perona Malik model with b=0.01, at t=4.



Perona Malik at t=4.


There is hardly any loss of visual quality of the image. Compare it to the original below. Notice there is some loss of quality in her hair.



The original




Let us see what happens as we continue to t=10 below. Ok, the image is a bit too smooth, rather artistic.



Perona Malik at t=10


Comparison with heat equation



Compare these results with the heat equation at t=4 below. Very smooth, edges are lost. Not good.



Heat equation at t=4.

No comments:

Post a Comment