DEV Community

Franciso Zavala
Franciso Zavala

Posted on

Histogram equalization CLAHE algorithm.

The CLAHE (Contrast Limited Adaptive Histogram Equalization) algorithm is an image processing technique designed to enhance local contrast, particularly in images with very dark or bright regions. Unlike global histogram equalization (HE), which applies a single transformation to the entire image, CLAHE divides the image into small regions and performs local equalization. This helps to enhance details in low-contrast areas without excessively amplifying noise in uniform regions.

Image description

How does CLAHE work?.

  1. Dividing the image into blocks: Tthe image is segmented into uniformly sized blocks.

  2. Computing the histogram for each block: A pixel intensity histogram is calculated for each block, representing the distribution of brightness levels within that specific region.

  3. Histogram clipping: If any histogram bin exceeds a predefined maximum threshold, it is clipped to prevent excessive contrast amplification. The clipped excess is then redistributed evenly across all histogram bins, reducing noise in uniform areas.

  4. Local histogram equalization: After adjusting the histogram, histogram equalization is applied to each block. This is done using the cumulative distribution function (CDF), which redistributes pixel intensity levels more uniformly.

  5. Bilinear interpolation between blocks: To prevent abrupt transitions between blocks when reconstructing the image, bilinear interpolation is applied. This smooths out contrast differences between regions, resulting in a more natural and continuous output.

  6. Merging the processed blocks: Finally, after equalization and interpolation, the processed blocks are merged to form the final image with enhanced contrast.

read the full article`

Top comments (0)