Arithmetic operations#
In the end, an image is an array of numbers. So mathematical operations can be performed on these numbers. In this section, we consider 2D images but the generalization to different dimensions is obvious.
Addition#
The addition of two images \(f\) and \(g\) of the same size results in a new image \(h\) of the same size whose pixels are the sum of the pixels in the original images:
\[
\forall m, n,\quad
h(m,n) = f(m,n) + g(m,n).
\]
Fig. 20 gives an example of image addition to produce an artistic effect. Addition can also be used to denoise a series of images.
Subtraction#
The subtraction of two images is used for example to detect changes (Fig. 21).
\[\begin{split}
&\forall m, n,\quad h(m,n) = f(m,n) - g(m,n) \\
\text{or}\qquad
&\forall m, n,\quad h(m,n) = | f(m,n) - g(m,n) |
\end{split}\]
Division#
The division of two images is used to correct non-homogeneous illumination. Fig. 22 illustrates the removal of shadow.
\[
\forall m, n,\quad
h(m,n) = \frac{f(m,n)}{g(m,n)}.
\]