Intensity Transformations and Histogram Equalisation

Intensity transformations

Figures 1b-1g below are the results obtained when intensity transformations were applied on a digital image in grayscale.

 

Figure 1: Intensity transformations applied on a grayscaled digital image of Vincent Van Gogh’s “Starry Night.”

 

Negative of the the original image, which has gray level values in the range [0, L-1], was operated using the expression

 s = L - 1 - r

where r and s are the intensity of the input image, fig. 1a,  and output image, fig. 1b, respectively [2]. See how the graph in fig. 2 illustrates the correlation  between r and s in a negative transformation.

 

basic_trns_fnc.PNG

Figure 2: Some primary intensity transformation functions [1].

 

Log transform, on the other hand, is different. It is given by

 s = c \; log(1+r)

Narrow range of lower input intensity values become wider in the output, and vice versa. Its curve remains the same. However, the output gets manipulated by a constant factor c. It is important to keep in mind that r should never be less than zero, due to laws governing logarithms [2].

Gamma transforms are governed by the equation

s = c \; r^\gamma

where c and \gamma are positive constants. Its input-output curve looks similar to a log transform, except that it varies depending on the value of \gamma. When \gamma < 1, the curve becomes an nth-root, making the output image brighter, and vice versa. This process turns into identity transformation when \gamma = 1 [2]. See from fig. 1d that \gamma = 2.5 makes the output image darker since a wide range of lower values in the input are compressed on a narrow range of lower values in the output.

 

contrast_strt_fnc

Figure 3: Contrast-stretching transformation function [2].

 

Graph from fig. 3, left side, illustrates the transfer function of a contrast-stretching transformation

g = \dfrac{1}{1 + (m/f)^E}

where m \epsilon [0,255] and E controls the slope of the function [2]. If we set E to approach infinity, contrast-stretching reduces to thresholding (right side of figure 3), which gives a binary output. Contrast stretching widens a narrow range in the input, while pixels outside those range are left either black or white, depending on where m is set. In figures 1e-1f, m lies on the mean of the input f.

 

slice_fnc

Figure 4: Intensity-level slicing [1]. Left side gives a certain intensity value to all pixels within the range A to B, while others are set to zero. Right side graph preserves the rest, while doing the same thing pixels included in the range.

 

Two types of intensity-level slicing are depicted in fig. 4. The transformation depicted in the left side of the figure was employed in fig. 1g. In this image, values of pixels having gray level values between 100 to 150 are set to 255, while others are zero.

Intensity transformations applied on fig. 1 were also implemented in a user-friendly program, a command-line. Choices of transformations, along with their required parameters, are listed in the first comments of the code.

 

Histogram equalisation

 

Figure 5: Histogram Equalization applied on a dark image.

 

Figure 5a shows a dark grayscale image. Its corresponding histogram is shown in fig. 5c, which shows that the pixel values were compressed in a narrow range near zero. Additionally, corresponding histogram is in fig. 5e. By applying histogram equalisation, we distribute the bins in fig. 5c over all the available gray values, from 0 to 255, as can be seen in fig. 5d. Resulting image from the modified histogram can be seen in fig. 5b. Notice the difference with respect tot the original image, when it comes on the details observable by the human eyes. The modification resulted on linearization in the cumulative distribution function.

 

References

[1] R. Gonzalez and R. Woods. Digital Image Processing, 2nd ed. Chapter 3. Prentice Hall. New Jersey. 2002.

[2] R. Gonzalez, R. Woods, S. Eddins. Digital Image Processing Using MATLAB, 2nd ed. Chapter 3. Prentice Hall. New Jersey. 2009.

Leave a comment