# Non-linear Image Diffusion and Efficient Solver

Here is a reworked version of a technical paper related to non-linear image diffusion and a solver that can be used for efficiently solving the equation. The tutorial shows, step by step, how the equation is discretized and converted into a form that allows it to be solved using numerical methods. These same concepts apply to other computer vision related problems as well!

## Equation

The equation that we will be using is as follows:

$\frac{\partial I_k}{\partial t} = DIV \big( g(x,y,t) \nabla I_k \big)$

, where $$k$$ refers to the image channel in question (e.g. R, G or B), $$g(x,y,t)$$ is a function that defines the (scalar) diffusion weights, and $$\nabla = [\frac{\partial}{\partial x}, \frac{\partial}{\partial y}]$$. The idea of this equation is to diffuse image information in homogeneous areas of the image. Homogeneous here means areas where the pixel values are roughly the same. Therefore, we blend image information inside objects while borders (also known as edges) are left intact. As an example, suppose we have two different objects in the image, a dog and a cat. We want to diffuse the image inside the dog- and the cat objects but we do not want to diffuse at the borders separating the dog from the cat. As will be shown later on, diffusion is controlled by using a function $$g(x,y,t)$$ that controls the diffusion weights for each pixel.

## Solver

The solver that is used for solving the equation is a block-solver called Tri-Diagonal Matrix Algorithm (TDMA). The tutorial shows all the steps how the diffusion equation is discretized and how the solver is constructed. What is interesting is that this same solver can be used for solving variational optical-flow and stereo disparity equations as well.