1
$\begingroup$

I want to understand the main idea behind AHE and the way for applying it manually with my hands.

Wikipedia says:

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?

Edit1
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.

Edit2
Gonzalez in pages 149,150 of Digital Image Processing, Global Edition says:

The procedure is to define 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 specification 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.

$\endgroup$
1

1 Answer 1

1
$\begingroup$

Does above mean for computing AHE we divide the matrix into distinct squares and do HE on each square separately?

Yes.

Does it again says what I quoted from Wikipedia?

Yes.

Does "its rank in the pixels surrounding it" mean applying the usual HE?

Yes.

I think it says for each pixel we have to consider a square around it and first apply the usual HE ...

Yes.

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.

No.

It's just saying the same as the previous ones: check where the current pixel's level is with respect to all the others in its region ("adaptive area").

The comparison is just done against the original image's pixel intensities.

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?

The square is always centered around each pixel in turn.

Added

Is there a formula for size of squares for dividing image? (OpenCV uses 8 as default)

I don't think there's really a way to calculate it. It really depends on the type of image you're using and the resolution of the objects in the image.

$\endgroup$
6
  • $\begingroup$ Thank you for your time. I edited my question. Please see it. I think there are different ways for doing local histogram equalization. What is your opinion? $\endgroup$ Jan 1, 2023 at 21:28
  • $\begingroup$ Also what about this: Is there a formula for size of squares for dividing image? $\endgroup$ Jan 1, 2023 at 21:29
  • $\begingroup$ @hasanghaforian That new link just seems to want to calculate the AHE quickly. If it changes the algorithm, then it's no longer AHE. $\endgroup$
    – Peter K.
    Jan 1, 2023 at 21:54
  • $\begingroup$ It seems that you say only usual HE on smaller parts of image and anything else is not AHE. Also in your answer you wrote "check where the current pixel's level is with respect to all the others in its region ("adaptive area").". We know that this check is not part of usual HE so, as you said, it should not effect on output of HE. If this "check" has no effect on output, why is it necessary? $\endgroup$ Jan 1, 2023 at 22:47
  • $\begingroup$ @hasanghaforian The check is definitely part of the usual HE, it’s just that the usual HE uses the whole image as the check area, not a subset of the image. $\endgroup$
    – Peter K.
    Jan 1, 2023 at 23:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.