RTUComputer ScienceYr 2020 · Sem 82020

Q18Digital Image Processing

Question

10 marks

Explain histogram processing techniques in detail. Provide a detailed explanation of histogram equalization and histogram matching (specification).

Answer

A massive mathematical exposition on Histogram Processing. Violently details the rigorous discrete probability calculations of Histogram Equalization for max contrast, and strictly outlines the complex inverse mapping architecture of Histogram Specification (Matching).

The histogram of a digital image is a strict discrete probability density function (PDF). It mathematically plots the number of pixels at each specific gray level from 0 (Black) to 255 (White). If an image is massively underexposed, the histogram is violently crushed into the dark side of the graph. Histogram processing utilizes non-linear transformation functions to mathematically stretch and manipulate this distribution to drastically improve visual clarity.

The absolute goal of Histogram Equalization is to mathematically generate an image whose histogram is perfectly flat—meaning every single gray level from 0 to 255 possesses the exact same number of pixels. This violently maximizes the global contrast of the image.

The Mathematical Algorithm

Let be the original gray level, and be the new transformed gray level. Let be the total number of pixels, and be the number of pixels with gray level .

  • Step 1: Calculate PDF. Calculate the probability of occurrence for each gray level: .
  • Step 2: Calculate CDF (The Transformation Function). Violently calculate the Cumulative Distribution Function (CDF). For any gray level , sum all probabilities from up to :
  • Step 3: Map to Scale. Multiply the CDF values by the absolute maximum gray level (e.g., 255 for 8-bit) and mathematically round to the nearest integer:
  • Step 4: Execute Transformation. If the algorithm dictates that original level 10 maps to new level 45, the computer violently scans the entire image and changes every single pixel of value 10 into a 45.

Because it uses the CDF, the transformation is monotonically increasing, mathematically guaranteeing that dark pixels never become lighter than originally bright pixels (preventing image inversion).

Histogram Equalization is an absolute "dumb" algorithm. It always tries to make the image perfectly flat. In many scenarios (like radar imaging), a flat histogram destroys the data. Histogram Specification is a highly complex architecture that forces the original image to mathematically match a specific, user-defined target histogram shape.

The Mathematical Pipeline

  • Step 1: Mathematically compute the Equalized CDF of the original image (Let this mapping be ).
  • Step 2: Take the desired, user-provided target histogram. Mathematically compute ITS Equalized CDF (Let this mapping be ).
  • Step 3: The Inverse Mapping: We now possess two mappings. We violently calculate the Inverse mapping function .
  • Step 4: For every pixel in the original image, we first push it through to equalize it, and then violently push it backward through the inverse function to map it into the target shape.

This allows an engineer to mathematically force a daytime photograph to perfectly match the exact histogram distribution of a nighttime photograph.

Histogram Equalization ProcessOriginal Dark Image PDF0255CDF TransformEqualized Flat PDF0255Mathematical TransformationS_k = Round(255 * sum(p(r_j)))Violently stretches the compressed pixel clusteracross the entire 0-255 spectrum.
Back to Paper