Intensity Transformation Functions

·

8 min read

Intensity Transformation Functions

Intensity transformations are among the simplest of all image processing techniques.

As an introduction to intensity transformations, consider the graph below, which shows three basic types of functions used frequently in image processing: linear (negative and identity transformations), logarithmic (log and inverse-log transformations), and power-law (nth power and nth root transformations). The identity function is the trivial case in which the input and output intensities are identical.

Digital Negative

The image negative is a simple operation used in image processing to invert the colours of an image. In a grayscale image, this means converting white areas to black and black areas to white, essentially creating a 'photo negative' effect.

The formula to obtain the negative of an image is straightforward. For grayscale images, where pixel values range from 0 (black) to 255 (white), the negative of a pixel value P is given by:

Negative(P) = L - 1 - P

Here, L is the maximum pixel intensity value in the image (usually 256 for 8-bit grayscale images), and P is the original pixel value.

For instance, let's say we have a grayscale image represented by a single pixel with a value of 100 (on a scale of 0 to 255):

Given pixel value P = 100
Using the formula for the negative:
L (maximum intensity value) = 256 (for an 8-bit grayscale image)
Negative(P) = 256 - 1 - 100 Negative(P) = 255 - 100 Negative(P) = 155

Therefore, the negative of the pixel value 100 is 155. This means that inverting the grayscale value of 100 gives us a value of 155.

For color images, the negative operation involves separately inverting the red, green, and blue components of each pixel, creating an inverted color effect.

This simple operation is often used for various image enhancement and processing techniques to bring out certain features or enhance visual effects.

Log Transformations

Logarithmic transformations are a technique used in digital image processing to manipulate the pixel intensities in an image. These transformations are applied to enhance certain features or adjust the dynamic range of an image.

The formula for the log transformation of an image is:

[s = c * log(1 + r)]

Here:

  • (s) is the output pixel value after transformation.

  • (r) is the input pixel value before transformation.

  • (c) is a constant that scales the output values (often used to map the output range to 0-255 for an 8-bit image).

The log function enhances the lower intensity values more than the higher ones. It spreads out the lower values and compresses the higher values, which can improve the visibility of details in darker areas while maintaining the highlights.

For instance, if we have an input pixel value, (r), and we want to apply a log transformation with a scaling constant (c):

Let's say (r = 50) (the original pixel value).

If we choose a scaling constant (c = 1) for simplicity, although in practice, this constant might vary:

s = 1 * log(1 + 50)
s = log(51)
s = approx 3.931

This transformed pixel value (s) will replace the original pixel value (r = 50) in the image.

Log transformations are commonly used in image enhancement techniques to adjust the brightness or contrast of an image, particularly for images with a wide range of intensity values, such as those containing both dark and bright regions. They can bring out details in the darker areas, making the overall image more visually appealing or aiding in analysis.

Power Law Transformations

Power-law transformations, often referred to as gamma transformations, are a type of image enhancement technique used in digital image processing. These transformations adjust pixel intensities by applying a power-law function to each pixel value.

The general formula for a power-law transformation is:

Here:

  • s is the output pixel value after transformation.

  • r is the input pixel value before transformation.

  • γ is the gamma value (exponent) that controls the shape of the transformation curve.

  • c is a constant that scales the output values.

The gamma value (γ) determines the type of adjustment applied to the image. Different gamma values will produce different effects:

  • If γ < 1: It decreases the contrast of the image. Lower gamma values emphasize the higher pixel values and de-emphasize the lower ones. This enhances details in brighter areas but may reduce details in darker areas.

  • If γ > 1: It increases the contrast of the image. Higher gamma values emphasize the lower pixel values and de-emphasize the higher ones. This enhances details in darker areas but may lose details in brighter areas.

  • If γ = 1: It represents a linear transformation, where the output pixel values are directly proportional to the input pixel values. It doesn't affect the image contrast.

For example, let's consider an input pixel value r\=100 and apply a power-law transformation with a gamma value of γ\=0.5 and a scaling constant of c\=1 for simplicity:

The transformed pixel value s will replace the original pixel value r\=100 in the image.

Power-law transformations are used in image processing for various purposes, including adjusting image contrast, enhancing specific features, or improving the visualization of certain details in an image. They are particularly useful in manipulating the brightness and contrast of an image to suit specific preferences or analysis requirements.

Contrast Stretching

Contrast stretching, also known as normalization, is a technique used in image processing to improve the contrast in an image by expanding the range of intensity values.

The formula for contrast stretching involves linearly scaling the pixel values from their original range to a desired range:

  • s is the output pixel value after transformation.

  • r is the input pixel value before transformation.

  • r_min and r_max represents the minimum and maximum pixel values in the original image.

  • s_min and s_max represents the desired minimum and maximum values for the stretched image.

Intensity Level Slicing

Intensity level slicing is an image processing technique used to highlight specific intensity levels within an image by selectively manipulating pixel values.

The basic concept involves separating the pixels of an image into different intensity ranges and then highlighting or enhancing certain levels while suppressing others.

Here's a general approach to intensity level slicing:

  1. Thresholding: Select a range or multiple ranges of intensity levels that you want to emphasize within the image.

  2. Highlighting: Set pixels within the chosen intensity range(s) to a certain value (often a higher intensity or a distinct color), making them more prominent.

  3. Suppressing: Pixels outside the chosen intensity range(s) are either set to a lower intensity or completely suppressed (made black or white), reducing their prominence in the final image.

For example, suppose we have a grayscale image where most of the details we're interested in are within a specific range of intensities, say between 100 and 150.

Using intensity level slicing:

  • Pixels with intensity values between 100 and 150 are highlighted by assigning them a higher value or a different color to make them stand out.

  • Pixels outside this range (below 100 or above 150) are either dimmed by assigning them lower intensities or made completely black or white, depending on the intended effect.

This technique can be helpful in various applications, such as highlighting objects or features within a certain intensity range in medical imaging, enhancing specific details in photographs, or simplifying images for further analysis by suppressing irrelevant intensity levels.

However, intensity level slicing can also result in loss of information outside the selected intensity ranges, so it's essential to carefully choose the thresholds and understand the impact on the overall image.

Bit-Plane Slicing

Bit plane slicing is a technique used in image processing to decompose an image into its individual bit planes. In digital images, each pixel's grayscale intensity is represented by a binary number. Bit plane slicing separates these binary bits that make up the pixel values.

Here's how it works:

  1. Binary Representation: In a grayscale image, each pixel's intensity value is represented as an 8-bit binary number (for 8-bit images), ranging from 0 to 255. For instance, the decimal value 175 in binary is 10101111.

  2. Bit Plane Decomposition: Bit plane slicing involves separating these 8 bits that make up the pixel values. Each bit represents a different power of 2 in the binary number.

  3. Individual Bit Planes: For an 8-bit image, you have eight individual bit planes, each containing information about a specific bit position from the binary representation of the pixel values. These planes are typically labeled from 0 to 7, where plane 0 holds the least significant bit (LSB) and plane 7 holds the most significant bit (MSB).

  4. Visualizing Bit Planes: Viewing these bit planes separately allows us to observe the contribution of each bit to the overall image. Bit plane 0 (LSB) contributes the least to the image's visual appearance, while bit plane 7 (MSB) contributes the most.

  5. Image Reconstruction: You can reconstruct the original image by combining the selected bit planes. Combining more significant bit planes tends to give more details and clarity, while combining less significant bit planes results in a coarser representation of the image.

This technique is often used for analysis, compression, and manipulation in image processing tasks. It helps visualize the importance of each bit in representing the image's visual information and can be utilized in image encryption, watermarking, and compression algorithms.