I want to understand the main idea behind AHE and the way for applying it manually with my hands.
In its simplest form, each pixel is transformed based on the histogram of a square surrounding the pixel, as in the figure below. The derivation of the transformation functions from the histograms is exactly the same as for ordinary histogram equalization: The transformation function is proportional to the cumulative distribution function (CDF) of pixel values in the neighbourhood.
Does above mean for computing AHE we divide the matrix into distinct squares and do HE on each square separately?
Adaptive Histogram Equalization and Its Variations says:
In this basic form the method involves applying to each pixel the histogram equalization mapping based on the pixels in a region surrounding that pixel (its contextual region). That is, each pixel is mapped to an intensity proportional to its rank in the pixels surrounding it.
Does it again says what I quoted from Wikipedia? Does "its rank in the pixels surrounding it" mean applying the usual HE?
J. Alex Stark says:
The AHE process can be understood in different ways. In one perspective the histogram of grey levels (GL’s) in a window around each pixel is generated first. The cumulative distribution of GL’s, that is the cumulative sum over the histogram, is used to map the input pixel GL’s to output GL’s. If a pixel has a GL lower than all others in the surrounding window the output is maximally black; if it has the median value in its window the output is 50% grey.
It seems this one differs from what I quoted earlier. I think it says for each pixel we have to consider a square around it and first apply the usual HE and store the result in another temp matrix, then compare the intensity of center pixel with intensities of other pixels in temp matrix and decide the output of AHE for center pixel is 50% gray or black. If it is true, then the output most only has two colors: black and 50% gray and no white pixel!
Now I have other questions:
- Do I understand above ways?
- Are those same or different ways?
- Are all of them AHE?
- Is there a formula for size of squares for dividing image? (OpenCV uses 8 as default)
- For getting the output of each pixel, do I have to consider a square around desired pixel or I have to divide image into distinct squares and get the output for all pixels of each square at once?
- If above quotes guide to different AHE s, then do all improve the problem of HE?
After I asked this question I continue searching and found this which I think partially clear what I doubted from what had saied J. Alex Stark.
Gonzalez in pages 149,150 of Digital Image Processing, Global Edition says:
The procedure is to deﬁne a neighborhood and move its center from pixel to pixel in a horizontal or vertical direction. At each location, the histogram of the points in the neighborhood is computed, and either a histogram equalization or histogram speciﬁcation transformation function is obtained. This function is used to map the intensity of the pixel centered in the neighborhood. The center of the neighborhood is then moved to an adjacent pixel location and the procedure is repeated. ... Another approach used sometimes to reduce computation is to utilize nonoverlapping regions, but this method usually produces an undesirable “blocky” effect.