Total Pageviews

Wednesday, September 2, 2026

Histogram Equalization Visualizer

📊 Histogram Equalization Visualizer

Upload an image and explore grayscale conversion, histogram analysis, histogram equalization and its mathematics.
Please upload an image to begin.

1. Original Image

2. Grayscale Image

3. Grayscale Histogram

4. Histogram Values

Gray Level Frequency Probability CDF New Gray Level

5. Equalized Image

6. Histogram After Equalization

🧮 Histogram Equalization Mathematics

Step 1: Find the frequency

For every grayscale intensity rk, count how many pixels have that intensity.

nk = Number of pixels having intensity rk
Step 2: Calculate probability

Let n be the total number of pixels.

p(rk) = nk / n
Step 3: Calculate cumulative distribution function (CDF)
CDF(rk) = Σ p(rj)    for j = 0 to k

The CDF adds the probabilities from the first gray level up to the current gray level.

Step 4: Histogram equalization formula
sk = (L - 1) × CDF(rk)

Where:

  • L = number of possible gray levels
  • For an 8-bit image, L = 256
  • Therefore L − 1 = 255
  • rk = original gray level
  • sk = new equalized gray level
Step 5: Example calculation

Suppose an intensity level has:

CDF = 0.60

For an 8-bit image:

s = 255 × 0.60
s = 153

Therefore, the original gray level is mapped to approximately gray level 153.

Complete process
Image → Grayscale → Histogram → Probability → CDF → Mapping → Equalized Image

No comments:

Post a Comment