This article is inspired by the lecture videos by Prof. Daniel Cremers and also by the coursera course Image and Video Processing: From Mars to Hollywood with a Stop at the Hospital (by Duke University).

1. The Diffusion Equation and Gaussian Blurring Diffusion is a physical process that minimizes the spatial concentration u(x,t) of a substance gradually over time. The following figure shows the PDE of general diffusion (from the Fick’s law), where the diffusivity g becomes a constant, the diffusion process becomes linear, isotropic and homogeneous.

Here we shall concentrate mainly on the linear (Gaussian blur) and non-linear (e.g., edge-preserving) diffusion techniques.

The following figures show that the Gaussian Blur on an image can be thought of as heat flow, since the solution of the (linear) diffusion equation is typically the Gaussian Kernel convolution, as shown in the 1-D case, the diffusion equation has a unique solution with Gaussian convolution kernel G ( 0 , σ = √( 2 t )) , where the bandwidth of the kernel changes proportional to the square root of the time.

We can verify that the solution satisfies the equation, but more generally, the solution of the diffusion equation can be analytically obtained using the Fourier transform, as descried here in this post.

Since linear diffusion can be implemented more efficiently with Gaussian Filter, let’s focus on the non-linear diffusion techniques. One interesting example of a non-linear diffusion is edge-preserving diffusion from this seminal paper by Perona-Mallik, as shown in the next figure.

The next animations show the results of a non-linear diffusion implementation with gradient descent, with 100 iterations using the edge-preserving diffusivity defined as above on the lena image with different λ (mentioned as kappa in the Perona-Mallik paper) values, the first one with λ = 10 and the second one with λ = 100 .

The next animation shows blurring the same image with simple filtering with the Gaussian kernel (equivalent to linear diffusion), as can be seen the edge-preserving non-linear diffusion does a way better job in terms of preserving edges, for small values of the parameter λ .

The next animations show tthe results of a non-linear diffusion implementation with gradient descent, this time with 50 iterations using the edge-preserving

diffusivity on yet another image (monument) with different λ (mentioned as kappa in the Perona-Mallik paper) values, the first one with λ = 10 and the second one with λ = 100 .

The next image shows the difference between the output after GD and the input image.

The above image shows how the edge detection can be done with edge-preserving non-linear diffusion. The next results compare the edge detection result obtained using edge-preserving non-linear diffusion and the one obtained with canny edge detector on my image.







The next image shows the edges detected with the difference image obtained with non-linear diffusion, which are much more subtler than canny’s.





2. Denoising Images with Variational Methods, Euler-Lagrange equation for the functional and Gradient Descent

The following figures describe the theory required to de-noise an image with variational methods, using gradient descent.

The following animations and figures show the implementation results of the above technique, for a noisy ship image, taken from the book Variational Methods in Image Processing , by Luminita A. Vese, Carole Le Guyader.

The following figure shows the difference image in between the original input image and the gradient descent output image.