Histogram transformations#
An histogram transformation consists in applying a mathematical function to the intensity distribution. Generally, the transformations are useful to improve the visual quality of an image, but are rarely needed inside an automatic processing.
The transform, denoted \(T\), is applied on the pixel intensities to change their values:
where \(j\) and \(i\) are respectively the intensities of the new and the original image. As a consequence, the histogram of the new image differs from the histogram of the original image.
Below are some common transformations (we suppose the pixel intensities to lie in \([0,1]\)).
Negative image#
Gamma correction#
Histogram spreading#
(french: étalement d’histogramme)
where \(i_\text{min}\) and \(i_\text{max}\) are respectively the minimum and maximum intensities in the image.
Histogram equalization#
(french: égalisation d’histogramme)
where \(M\) and \(N\) are the image size and \(n_k\) is the number of pixels with intensity \(k\). This transformation aims to spread the histogram over the entire intensity range, and to make the histogram as flat as possible. A consequence is an increasing of the image contrast. It is a fully automatic method that does not require any parameters to be set. The demonstration of this equation is available in [Gonzalez 2010, section 3.3.1].
Thresholding#
The histogram is sometimes very useful to segment the image in two classes, that is to distinguish the objects in the image with respect to their gray level. Indeed, if the histogram shows clearly two modes (i.e. two “bumps”), a threshold \(T\) can be defined between these two modes, then apply a thresholding on the pixels, such that:
if the pixel level is lower that \(T\), then the pixel is in class 0 (displayed in black in Fig. 25),
otherwise the pixel is in class 1 (displayed in white in Fig. 25).
Such a thresholding yields a binary image whose pixels have only two values. Several methods exist that compute automatically the threshold, such that Otsu’s method.