Recent from talks
Nothing was collected or created yet.
Histogram equalization
View on WikipediaThis article's lead section may be too short to adequately summarize the key points. (November 2023) |

Histogram equalization is a method in image processing of contrast adjustment using the image's histogram.
Histogram equalization is a specific case of the more general class of histogram remapping methods. These methods seek to adjust the image to make it easier to analyze or improve visual quality (e.g., retinex).
Overview
[edit]This method usually increases the global contrast of many images, especially when the image is represented by a narrow range of intensity values. Through this adjustment, the intensities can be better distributed on the histogram utilizing the full range of intensities evenly. This allows for areas of lower local contrast to gain a higher contrast. Histogram equalization accomplishes this by effectively spreading out the highly populated intensity values, which tend to degrade image contrast.
The method is useful in images with backgrounds and foregrounds that are both bright or both dark. In particular, the method can lead to better views of bone structure in x-ray images and to better detail in photographs that are either over or under-exposed. A key advantage of the method is that it is a fairly straightforward technique adaptive to the input image and an invertible operation. So, in theory, if the histogram equalization function is known, then the original histogram can be recovered. The calculation is not computationally intensive. A disadvantage of the method is that it is indiscriminate. It may increase the contrast of background noise, while decreasing the usable signal. In scientific imaging where spatial correlation is more important than intensity of signal (such as separating DNA fragments of quantized length), the small signal-to-noise ratio usually hampers visual detections.
Histogram equalization often produces unrealistic effects in photographs; however it is very useful for scientific images like thermal, satellite or x-ray images, often the same class of images to which one would apply false-color. Also histogram equalization can produce undesirable effects (like visible image gradient) when applied to images with low color depth. For example, if applied to 8-bit image displayed with 8-bit gray-scale palette it will further reduce color depth (number of unique shades of gray) of the image. Histogram equalization will work the best when applied to images with much higher color depth than palette size, like continuous data or 16-bit gray-scale images.
There are two ways to think about and implement histogram equalization, either as image change or as palette change. The operation can be expressed as where is the original image, is histogram equalization mapping operation and is a palette. If we define a new palette as and leave image unchanged then histogram equalization is implemented as palette change or mapping change. On the other hand, if palette remains unchanged and image is modified to then the implementation is accomplished by image change. In most cases palette change is preferred as it preserves the original data.
Modifications of this method use multiple histograms, called subhistograms, to emphasize local contrast rather than overall global contrast. Examples of such methods include adaptive histogram equalization and variations including, contrast limited adaptive histogram equalization, multipeak histogram equalization, and multipurpose beta-optimized bihistogram equalization (MBOBHE). The goal of these methods, especially MBOBHE, is to modify the algorithm to improve the contrast without producing brightness mean-shift and detail loss artifacts.[1]
A signal transform equivalent to histogram equalization also seems to happen in biological neural networks so as to maximize the output firing rate of the neuron as a function of the input statistics. This has been proved in particular in the fly retina.[2]
Back projection
[edit]The back projection of a histogrammed image is the re-application of the modified histogram to the original image, functioning as a look-up table for pixel brightness values.
For each group of pixels taken from the same position from all input single-channel images, the function puts the histogram bin value to the destination image, where the coordinates of the bin are determined by the values of pixels in this input group. In terms of statistics, the value of each output image pixel characterizes the probability that the corresponding input pixel group belongs to the object whose histogram is used.[3]
Implementation
[edit]Consider a discrete grayscale image and let be the number of occurrences of gray level . The probability of a pixel value chosen uniformly randomly from image being , is
being the total number of gray levels in the image, being the number of pixels in the image with value , and being the total number of pixels in the image. Then is the image's histogram value for , with the histogram normalized to have a total area of 1.
Let us then define the cumulative distribution function of pixels in image . For value it is
- ,
which is also the image's accumulated normalized histogram.
We would like to create a transformation to produce a new image , with a flat histogram. Such an image would have a linearized cumulative distribution function (CDF) across the value range, i.e.
- for
for some constant . The properties of the CDF allow us to perform such a transform (see Inverse distribution function). It is defined as
where is in the range . Notice that maps the levels into the range , since we used a normalized histogram of . In order to map the values back into their original range, the following simple transformation needs to be applied to each transformed image value :
is a real value while has to be an integer. An intuitive and popular method[5] is applying the round operation:
- .
However, detailed analysis results in slightly different formulation. The mapped value should be 0 for the range of . And for , for , ...., and finally for . Then the quantization formula from to should be
.
(Note: when , however, it does not happen just because means that there is no pixel corresponding to that value.)
On color images
[edit]The above-described histogram equalization works on a grayscale image. It can also be used on color images. One option is applying the method separately to the red, green and blue components of the RGB color values of the image, which likely produces dramatic changes in the image's color balance since the relative distributions of the color channels change as a result of applying the algorithm. However, if the image is first converted to another color space, Lab, or HSL/HSV in particular, then the algorithm can be applied to the luminance or value channel without resulting in changes to color properties of the image.[6]
There are several histogram equalization methods in 3D space[7] which result in whitening, i.e., the probability of bright pixels is higher than that of dark ones.[8] Han et al. proposed to use a new CDF defined by the ISO-luminance plane, which results in uniform gray distribution.[9]
Examples
[edit]The operation equalization process is best demonstrated with a small image. A full-sized image demonstrates the overall results achievable using the process.
Small image
[edit]
The 8-bit grayscale image shown has the following values:
| 52 | 55 | 61 | 59 | 79 | 61 | 76 | 61 |
|---|---|---|---|---|---|---|---|
| 62 | 59 | 55 | 104 | 94 | 85 | 59 | 71 |
| 63 | 65 | 66 | 113 | 144 | 104 | 63 | 72 |
| 64 | 70 | 70 | 126 | 154 | 109 | 71 | 69 |
| 67 | 73 | 68 | 106 | 122 | 88 | 68 | 68 |
| 68 | 79 | 60 | 70 | 77 | 66 | 58 | 75 |
| 69 | 85 | 64 | 58 | 55 | 61 | 65 | 83 |
| 70 | 87 | 69 | 68 | 65 | 73 | 78 | 90 |
The histogram for this image is shown in the following table. Pixel values that have a zero count are excluded for the sake of brevity.
Value Count Value Count Value Count Value Count Value Count 52 1 64 2 72 1 85 2 113 1 55 3 65 3 73 2 87 1 122 1 58 2 66 2 75 1 88 1 126 1 59 3 67 1 76 1 90 1 144 1 60 1 68 5 77 1 94 1 154 1 61 4 69 3 78 1 104 2 62 1 70 4 79 2 106 1 63 2 71 2 83 1 109 1
The cumulative distribution function (CDF) is shown below. Again, pixel values that do not contribute to an increase in the function are excluded for brevity.
(Please note that version is not illustrated yet.), Pixel Intensity , equalized 52 1 0 55 4 12 58 6 20 59 9 32 60 10 36 61 14 53 62 15 57 63 17 65 64 19 73 65 22 85 66 24 93 67 25 97 68 30 117 69 33 130 70 37 146 71 39 154 72 40 158 73 42 166 75 43 170 76 44 174 77 45 178 78 46 182 79 48 190 83 49 194 85 51 202 87 52 206 88 53 210 90 54 215 94 55 219 104 57 227 106 58 231 109 59 235 113 60 239 122 61 243 126 62 247 144 63 251 154 64 255
This CDF shows that the minimum value in the subimage is 52 and the maximum value is 154. The CDF of 64 for value 154 coincides with the number of pixels in the image. The CDF must be normalized to . The general histogram equalization formula is:
where is the minimum non-zero value of the cumulative distribution function (in this case 1), gives the image's number of pixels (for the example above 64, where is width and the height) and is the number of grey levels used (in most cases, like this one, 256).
Note that to scale values in the original data that are above 0 to the range 1 to , inclusive, the above equation would instead be:
where cdf(v) > 0. Scaling from 1 to 255 preserves the non-zero-ness of the minimum value.
The equalization formula for the example scaling data from 0 to 255, inclusive, is:
For example, the CDF of 78 is 46. (The value of 78 is used in the bottom row of the 7th column.) The normalized value becomes:
Once this is done then the values of the equalized image are directly taken from the normalized CDF to yield the equalized values:
| 0 | 12 | 53 | 32 | 190 | 53 | 174 | 53 |
|---|---|---|---|---|---|---|---|
| 57 | 32 | 12 | 227 | 219 | 202 | 32 | 154 |
| 65 | 85 | 93 | 239 | 251 | 227 | 65 | 158 |
| 73 | 146 | 146 | 247 | 255 | 235 | 154 | 130 |
| 97 | 166 | 117 | 231 | 243 | 210 | 117 | 117 |
| 117 | 190 | 36 | 146 | 178 | 93 | 20 | 170 |
| 130 | 202 | 73 | 20 | 12 | 53 | 85 | 194 |
| 146 | 206 | 130 | 117 | 85 | 166 | 182 | 215 |
Notice that the minimum value 52 is now 0 and the maximum value 154 is now 255.
Full-sized image
[edit]See also
[edit]References
[edit]- ^ Hum, Yan Chai; Lai, Khin Wee; Mohamad Salim, Maheza Irna (October 11, 2014). "Multiobjectives bihistogram equalization for image contrast enhancement". Complexity. 20 (2): 22–36. Bibcode:2014Cmplx..20b..22H. doi:10.1002/cplx.21499.
- ^ Laughlin, S.B (1981). "A simple coding procedure enhances a neuron's information capacity". Z. Naturforsch. 9–10(36):910–2.
- ^ Intel Corporation (2001). Open Source Computer Vision Library Reference Manual (PDF). Archived from the original (PDF) on April 9, 2015. Retrieved January 11, 2015.
- ^ University of California, Irvine Math 77C - Histogram Equalization at the Wayback Machine (archived 2020-06-01(Calendar))
- ^ Gonzalez, Rafael C. (2018). Digital image processing. Richard E. Woods (4th ed.). New York, NY: Pearson. pp. 138–140. ISBN 978-1-292-22304-9. OCLC 991765590.
- ^ S. Naik and C. Murthy, "Hue-preserving color image enhancement without gamut problem," IEEE Trans. Image Processing, vol. 12, no. 12, pp. 1591–1598, Dec. 2003
- ^ P. E. Trahanias and A. N. Venetsanopoulos, "Color image enhancement through 3-D histogram equalization," in Proc. 15th IAPR Int. Conf. Pattern Recognition, vol. 1, pp. 545–548, Aug.-Sep. 1992.
- ^ N. Bassiou and C. Kotropoulos, "Color image histogram equalization by absolute discounting back-off," Computer Vision and Image Understanding, vol. 107, no. 1-2, pp.108-122, Jul.-Aug. 2007
- ^ Han, Ji-Hee; Yang, Sejung; Lee, Byung-Uk (2011). "A Novel 3-D Color Histogram Equalization Method with Uniform 1-D Gray Scale Histogram". IEEE Transactions on Image Processing. 20 (2): 506–512. Bibcode:2011ITIP...20..506H. doi:10.1109/TIP.2010.2068555. PMID 20801744. S2CID 17972519.
- Acharya and Ray, Image Processing: Principles and Applications, Wiley-Interscience 2005 ISBN 0-471-71998-6
- Russ, The Image Processing Handbook: Fourth Edition, CRC 2002 ISBN 0-8493-2532-3
- "Histogram Equalization" at Generation5 Archived 2016-05-16 at archive.today
Histogram equalization
View on GrokipediaOverview
Definition and Purpose
Histogram equalization is a method in digital image processing that adjusts the contrast of an image by modifying its pixel intensity distribution to utilize the full dynamic range.[4] This technique spreads out the most frequent intensity values, thereby enhancing areas of lower local contrast and improving overall image visibility.[4] The primary purpose of histogram equalization is to enhance the global contrast of images, particularly those where pixel intensities are clustered in a narrow range, making underlying features more discernible without introducing additional noise or losing original information.[4] It achieves this by redistributing intensity values to approximate a uniform histogram, which results in a more even spread across the available intensity range, such as 0 to 255 for 8-bit grayscale images. Developed in the 1970s as part of early computer vision techniques, histogram equalization was initially applied for preprocessing low-contrast images in medical and satellite imaging contexts.[5] Early implementations, such as those explored for real-time enhancement, demonstrated its utility in handling uneven illumination and improving detail in such domains.Benefits and Limitations
Histogram equalization offers several key benefits in image enhancement, primarily by improving overall contrast through the redistribution of intensity values to approximate a uniform histogram. This process effectively reveals hidden details in underexposed or overexposed regions, making it particularly useful for images captured under non-uniform lighting conditions, such as medical X-rays or outdoor photographs with varying illumination.[6] Additionally, the technique automates contrast adjustment without requiring manual parameter tuning, providing a straightforward, parameter-free approach that enhances visibility across a broad range of applications.[7] From a computational perspective, histogram equalization is highly efficient, operating in O(N) time complexity where N is the number of pixels, which makes it suitable for real-time processing on resource-constrained devices. In many cases, it also preserves edges and textures by maintaining the relative intensity relationships within local areas, avoiding significant distortion of structural features.[7][8] Despite these advantages, histogram equalization has notable limitations that can affect its suitability for certain images. It can amplify noise in flat or homogeneous regions, where subtle variations are stretched, leading to grainy artifacts that degrade perceived quality.[9] Furthermore, the method often causes over-enhancement, resulting in unnatural appearances, such as washed-out colors or halo effects around high-contrast boundaries, particularly in consumer photographs.[10] Histogram equalization performs poorly on images with bimodal histograms or high dynamic range, where the global transformation fails to balance disparate intensity distributions, potentially suppressing details in one mode while exaggerating the other. It is not ideal for already well-contrasted images, as applying it can introduce unnecessary alterations without benefit, and for scenarios requiring local enhancement, adaptive variants may be more appropriate to address regional variations without global over-correction.[4]Theoretical Foundation
Image Histograms
In digital image processing, particularly for grayscale images, an image histogram serves as a graphical representation of the frequency distribution of pixel intensities, illustrating how many pixels exhibit each possible intensity value. For an 8-bit grayscale image, intensity levels typically range from 0 (black) to 255 (white), resulting in 256 discrete bins, each corresponding to one intensity level where and . This histogram provides a visual summary of the image's intensity distribution, enabling analysis of its tonal range and overall quality. The computation of an image histogram begins by counting the occurrences of each intensity level across all pixels in the image. For an image containing total pixels, the histogram is defined as the number of pixels that have intensity , such that . To facilitate statistical interpretation, the normalized histogram, or probability density estimate, is given by , where the sum of over all equals 1, treating the intensities as a discrete probability distribution. This process assumes a grayscale image, where each pixel has a single intensity value, and forms the basis for statistical analysis in image enhancement techniques. Key properties of image histograms include their ability to reveal structural characteristics of the image. The cumulative histogram, computed as the running sum of frequencies up to a given level, , indicates the total number of pixels with intensities less than or equal to , providing insight into the distribution's spread. Histograms that are skewed—such as those clustered toward low intensities (dark images) or high intensities (bright images)—or narrow with a concentrated peak, signal poor contrast due to limited use of the available intensity range and clustering of pixel values, which obscures details. These properties make histograms foundational for identifying images that benefit from contrast enhancement methods like equalization.Probability Density Function and Cumulative Distribution Function
In image processing, the probability density function (PDF) characterizes the distribution of pixel intensities within an image. For continuous intensity values typically normalized to the range , the PDF represents the relative frequency of occurrence of intensity , such that the probability of a pixel having an intensity between and is . This function integrates to 1 over the full intensity range, providing a normalized measure of intensity distribution.[11] For discrete digital images with intensity levels where , the PDF is approximated using the image histogram as , where is the number of pixels with intensity and is the total number of pixels in the image. This approximation treats the histogram frequencies as empirical probabilities, enabling probabilistic analysis of discrete data.[11] The cumulative distribution function (CDF) extends the PDF by accumulating probabilities up to a given intensity. In the continuous case, it is defined as which yields values from 0 to 1 as spans the intensity range. For the discrete case, the CDF at level is Both forms are monotonically non-decreasing, ensuring they preserve the order of intensities.[11] In histogram equalization, the CDF plays a central role as a mapping function due to its monotonicity and range from 0 to 1, which allows transformation of the original intensity distribution into one that approximates uniformity. This redistribution enhances contrast by spreading intensities more evenly. A defining property of the equalized image is that its resulting CDF becomes linear, corresponding to a constant (uniform) PDF across the output intensity levels, thereby achieving the desired equalization effect.[11]Equalization Algorithm
Transformation Function Derivation
The transformation function in histogram equalization is designed to map the input intensity levels such that the output image has a uniform intensity distribution, thereby maximizing contrast utilization across the available dynamic range. Consider a continuous random variable representing the input intensity with probability density function defined over the interval for normalization. The goal is to find a transformation where is also in , such that the output density for all . By the probability integral transform theorem, if follows a continuous distribution with cumulative distribution function (CDF) , then the transformed variable follows a uniform distribution on . This follows from differentiating the CDF of : let , so assuming is strictly increasing and invertible; then . Thus, the transformation achieves the desired uniform output density.[12] For discrete images with intensity levels (typically ), the intensities are scaled to integers from 0 to . The continuous transformation is approximated by normalizing the discrete histogram probabilities and applying the discrete CDF: , where is the -th discrete level, is the number of pixels at level , and is the total number of pixels. This discrete form approximates the integral via summation of normalized histogram bins, yielding values in . The function is monotonic non-decreasing because the CDF is non-decreasing by definition, and strictly increasing where , ensuring that the order of pixel intensities is preserved and no information is lost due to mapping multiple inputs to the same output unless inherently tied in the input distribution.[12]Step-by-Step Process
The histogram equalization algorithm proceeds through a series of procedural steps to remap the intensity values of an image, aiming to produce a more uniform distribution across the intensity range. This process leverages the image's histogram to derive a monotonic, non-decreasing transformation function that spreads out the pixel intensities, thereby enhancing overall contrast without requiring prior knowledge of the image content. The steps are typically applied to grayscale images with discrete intensity levels ranging from 0 to , where is the number of possible intensity levels (commonly 256 for 8-bit images).[13]- Compute the image histogram: First, calculate the histogram for each discrete intensity level , where represents the number of pixels in the image that have intensity value . This step quantifies the frequency distribution of intensities in the original image.[13][14]
- Derive the probability density function (PDF) and cumulative distribution function (CDF): Normalize the histogram to obtain the PDF by dividing each bin count by the total number of pixels : . Then, compute the CDF by taking the cumulative sum up to level : . The CDF serves as the basis for the intensity transformation, as it is inherently monotonic and spans from 0 to 1.[13][14]
- Normalize the CDF to create the mapping table: Scale the CDF values to the full discrete intensity range by multiplying by and rounding to the nearest integer to ensure integer output levels: . This generates a lookup table that maps each original intensity to a new intensity , approximating a uniform distribution.[13][14]
- Apply the mapping to the image pixels: Traverse each pixel in the original image and replace its intensity value with the corresponding mapped value from the lookup table. This step produces the equalized output image.[13][14]
Implementation Details
Pseudocode and Computation
The implementation of histogram equalization typically involves computing the image histogram, deriving the cumulative distribution function (CDF), and applying a transformation via a lookup table for efficient pixel remapping. A standard pseudocode outline for grayscale images with intensity levels from 0 to (where is the number of discrete levels, such as 256 for 8-bit images) proceeds as follows:Initialize histogram h[0..L-1] to 0
For each pixel with intensity r in the image:
h[r] += 1
N = total number of pixels
cdf[0] = h[0] / N
For k = 1 to L-1:
cdf[k] = cdf[k-1] + h[k] / N
For k = 0 to L-1:
lut[k] = round( (L-1) * cdf[k] )
For each pixel with original value old_value:
new_value = lut[old_value]
Set pixel to new_value
Initialize histogram h[0..L-1] to 0
For each pixel with intensity r in the image:
h[r] += 1
N = total number of pixels
cdf[0] = h[0] / N
For k = 1 to L-1:
cdf[k] = cdf[k-1] + h[k] / N
For k = 0 to L-1:
lut[k] = round( (L-1) * cdf[k] )
For each pixel with original value old_value:
new_value = lut[old_value]
Set pixel to new_value
cv::equalizeHist() function processes 8-bit single-channel grayscale images by internally computing the histogram, CDF, and LUT, then applying the transformation, ensuring output values remain in the [0, 255] range without overflow.[18] Similarly, MATLAB's histeq function equalizes the histogram of grayscale images or indexed colormaps, using integer-compatible operations to map intensities while minimizing discrepancies between input and target cumulative histograms; it defaults to 64 bins but supports custom bin counts and returns values scaled appropriately for the input data type (e.g., uint8).[19] These functions leverage vectorized operations for speed, with notes in their documentation emphasizing integer arithmetic for discrete levels to maintain exact mappings.[18][19]
Discrete Intensity Handling
In digital images, intensity levels are discrete and finite, typically ranging from 0 to , where is the number of possible gray levels (e.g., for 8-bit images). The histogram equalization transformation for such discrete cases is defined as where is the -th input intensity level, is the estimated probability density function with as the frequency of level and as the total number of pixels, and denotes rounding to the nearest integer.[17] The rounding step in this formula often results in multiple consecutive input levels mapping to the identical output level , especially when the cumulative distribution function (CDF) increments are small relative to the quantization step of 1. This clustering effect flattens portions of the transformation curve, causing the output histogram to deviate from uniformity, with some bins receiving more pixels than others and potentially empty bins appearing.[17] In general, discrete histogram equalization does not produce a perfectly flat output histogram due to these quantization constraints. To address the non-uniformity arising from rounding, consistent application of the floor or round function is recommended to ensure a monotonic non-decreasing transformation, preserving the order of intensities. For improved uniformity, one common adjustment is to add 0.5 to the argument before rounding, effectively shifting the quantization boundaries to distribute output levels more evenly across the range. More advanced solutions involve histogram specification methods, which directly target a predefined uniform or near-uniform output histogram rather than relying solely on the CDF-derived mapping.[17] Quantization effects become particularly pronounced in low-bit-depth images, where is small (e.g., ), as the equalization stretches the limited intensity range, often revealing or exacerbating banding artifacts—visible steps in smooth gradients that the sparse levels cannot resolve adequately. Although dithering techniques, which add controlled noise to break up bands, could mitigate these artifacts in principle, they are not typically integrated into standard histogram equalization implementations, as the method prioritizes global contrast over local smoothness.[17] Due to the inherent discreteness of intensity levels, the resulting equalized histogram is only approximately uniform, with bin probabilities deviating from the ideal by amounts bounded on the order of , reflecting the granularity of the quantization process. This approximation holds well for high and large images, where statistical averaging minimizes irregularities, but underscores the theoretical limitations of applying continuous-domain concepts to discrete data.[17]Extensions to Color and Advanced Variants
Color Image Application
Applying histogram equalization to color images requires careful consideration to prevent unwanted color distortions, as the technique originally designed for grayscale images can alter hues if applied naively across channels. The standard approach involves transforming the image into a color space that decouples luminance from chrominance, such as YUV, and equalizing only the luminance channel while leaving the chrominance components unchanged. This preserves the relative color information, enhancing contrast without shifting hues. In the YUV color space, the Y component captures the luminance, derived from the RGB values as , while U and V encode the color differences. Histogram equalization is performed exclusively on the Y channel using the transformation , where is the number of gray levels (typically 256 for 8-bit images), is the probability density of level in the Y histogram, and the sum is the cumulative distribution function (CDF). The equalized Y values are then recombined with the original U and V to reconstruct the image, often converting back to RGB for display. This method leverages the perceptual uniformity of luminance in human vision, focusing enhancement on brightness distribution.[20] An alternative is to apply histogram equalization independently to each RGB channel, treating them as separate grayscale images. While straightforward and computationally efficient, this can cause significant hue shifts because the channels are interdependent; for instance, over-amplifying one channel relative to others may desaturate or tint areas like skin tones, leading to unnatural appearances.[21] The luminance-based method excels in maintaining color fidelity and perceptual naturalness, as chrominance remains intact, but it may underperform in boosting color saturation or vibrancy in low-contrast scenes. Conversely, independent channel equalization simplifies implementation without color space conversions but introduces artifacts like color bleeding or over-saturation in specific regions, making it less suitable for applications requiring accurate color reproduction.Adaptive and Contrast-Limited Variants
Adaptive histogram equalization (AHE) addresses the limitations of global histogram equalization by performing local contrast enhancement on image regions with varying intensity distributions. It divides the input image into small, typically non-overlapping tiles, computes a histogram and cumulative distribution function (CDF) for each tile independently, and applies the equalization transformation derived from that local CDF to pixels within the tile. For pixels near tile boundaries, bilinear interpolation of the transformation functions from adjacent tiles is used to ensure smooth transitions and avoid artifacts. This approach enhances local details in areas of low contrast, such as shadows or highlights, making it particularly useful for images with non-uniform illumination, including medical and natural scenes.[22] However, AHE can amplify noise in homogeneous regions due to the redistribution of intensities in local histograms, leading to over-enhancement where small intensity variations are exaggerated. To mitigate this, contrast-limited adaptive histogram equalization (CLAHE) was developed as an improvement, introducing a clipping mechanism to control contrast amplification. In CLAHE, before computing the CDF for each tile, histogram bins exceeding a predefined clip limit—typically 3 to 4 times the average bin height—are truncated, and the excess counts are redistributed uniformly across the histogram to prevent excessive stretching in flat regions. This limits noise amplification while preserving meaningful local contrasts, with common parameters including tile sizes of 8x8 pixels and a clip factor adjusted based on image content. Bilinear interpolation remains employed for seamless blending across tiles. Introduced in 1994 specifically for medical imaging applications like chest radiographs, CLAHE balances the detail enhancement of AHE with reduced artifacts, achieving better visualization of structures in low-contrast areas without the global uniformity imposed by standard methods. Unlike AHE, which may produce halo effects or excessive noise in uniform areas, CLAHE maintains perceptual quality by enforcing a contrast ceiling, making it widely adopted in fields requiring precise local enhancement, such as microscopy and remote sensing.Examples
Numerical Example
To illustrate histogram equalization on a small grayscale image, consider a 4×4 matrix with intensity levels from 0 to 7 (L=8 gray levels) and N=16 pixels total. The input image, which has intensities clustered toward lower values for demonstration, is given by:0 0 1 1
0 0 1 1
0 1 2 2
1 2 2 2
0 0 1 1
0 0 1 1
0 1 2 2
1 2 2 2
| r | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| h(r) | 5 | 6 | 5 | 0 | 0 | 0 | 0 | 0 |
2 2 5 5
2 2 5 5
2 5 7 7
5 7 7 7
2 2 5 5
2 2 5 5
2 5 7 7
5 7 7 7
| r | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|---|---|---|---|---|---|---|---|
| h'(r) | 0 | 0 | 5 | 0 | 0 | 6 | 0 | 5 |




