What is gray level transformation?

Image enhancement techniques are used to enrich the contrast and enhance the details of an image. These techniques play a vital role in image processing, and one commonly used method is gray-level transformation.

Gray level transformation

Gray level transformation allows the modification of pixel intensities by mapping input gray levels to various output levels, to achieve desired image enhancements. This mapping can easily be achieved through different mathematical functions.

However, the basic transformation function is given as follows:

Where O stands for output pixel value, I stands for input pixel value, and T stands for the transformation function that maps the pixel values of the input image to different output gray levels.

Types of transformation

There are three common types of gray-level transformation:

  1. Linear transformation

  2. Logarithmic transformation

  3. Power-Law transformation

Linear transformation

A linear transformation is achieved by applying a linear relationship to the pixels of an image to get the desired enhancements. This method is often used for adjusting the brightness and contrast of an image.

There are various types of linear transformation, that are discussed below.

Identity transformation

Identity transformation leaves the original pixel value of an image unchanged and maps it as is in the output image.

Formula

In this equation, the input and output pixel values are indicated by I and O respectively.

Graphical representation:

Identity Mapping
Identity Mapping

Here, the x-axis represents the input pixel values and the y-axis represents the output pixel values.

Negative transformation

Negative transformation inverts the pixel value of the image by subtracting it from the maximum pixel value. The resulting image is a digital negative of the original image.

Formula

In this equation, O implies the output pixel value and I implies the input pixel value. MAX represents the minimum pixel value in the input image.

Graphical representation

Here, the x-axis and y-axis represent the input and output pixel values respectively.

Logarithmic transformation

The logarithmic transformation uses logarithmic functions to modify the pixel values of an image. It redistributes the pixel values in an image, accentuating the detail in dim areas while compressing the details in brighter areas.

Formula

The mathematical formula for logarithmic transform is as follows:

In this equation, O indicates the resulting pixel value and I conveys the original pixel value. C marks the scaling factor which controls the degree of image enhancement.

Graphical representation

In this context, the x-axis is used to indicate or show the input pixel values, while the y-axis is used to portray or depict the output pixel values.

Inverse log transformation

The inverse log transformation, commonly known as exponential transformation is the inverse operation of the logarithmic transform. It is used to restore the original pixel values after logarithmic transformation.

Formula

The mathematical formula for exponential transform is as follows:

In this equation, the output pixel value is represented by O, while the input pixel value is represented by I. Additionally, the scaling factor, denoted by c, determines the level of image enhancement.

Graphical representation:

Here, the x-axis signifies the input pixel values. The y-axis denotes the output pixel values.

Power-law transformation

The power law transformation, also called gamma transformation is a technique that uses a power-law function to adjust the pixel values of an image. It is versatile, as it allows the emphasis on certain intensity ranges or enhancing specific details in an image.

Formula

The gamma transformation equation is given as:

In this context, the symbol c is used to represent the scaling factor, γ denotes the gamma correction value, and I and O respectively stand for the input and output pixel values.

  • If the value of gamma is greater than one, it stretches contrast in brighter areas and compresses the pixel values in the darker areas.

  • If the value of gamma is smaller than one, it enhances contrast in dim areas and compresses the pixel values in the bright areas.

Graphical Representation

Here, the x-axis and y-axis represent the input and output pixel values respectively and the shape of the graph varies with the gamma values.

Summary

Let's summarize the above concepts in a comparison table.

Linear

Logarithmic

Power-law

Linearity

Linear relation between input and output pixels

A non-linear relation between input and output pixels

A non-linear relation between input and output pixels

Changes

Can change contrast and brightness

Enhances details in darker regions

Can selectively enhance or compress different intensity ranges

Applications

Brightness and contrast adjustments

Used for increasing visibility in dim areas

Used for fine-tuning contrast for specific details

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved