Dr. Cho’s Website
Course Materials

Histogram equalization of images

Dr. Huidae Cho
Institute for Environmental and Spatial Analysis
University of North Georgia

1   Probability review

1.1   Histogram

\[h(r_k)=n_k\] and \[p(r_k)=\frac{n_k}{n}\]

  • $r_k$: $k^\text{th}$ gray level
  • $n_k$: Number of pixels with $r_k$
  • $n$: Total number of pixels
  • $h$: Histogram
  • $p$: Probability

2   Histogram equalization

Input image $r$ is scaled over $[0, 1]$ and output image $s$ is \[s=T(r)\quad 0\leq r\leq 1.\]

Histogram equalization requires the following conditions:

  • $T(r)$ is single-valued and monotonically increasing
  • $0\leq T(r)\leq 1$ for $0\leq r\leq 1$

2.1   Probability density functions of $r$ and $s$

Using transformations of probability density functions, we can obtain the probability of $s$ as follows: \[p_s(s)=p_r(r)\left|\frac{dr}{ds}\right|.\]

2.2   Transformation for histogram equalization

Let $s=T(r)=\int_0^r p_r(w)dw$, which is monotonically increasing and $0\leq T(r)\leq 1$.

2.3   Probability of $s$

\begin{split} \frac{ds}{dr}&=\frac{dT(r)}{dr}\\ &=\frac{d}{dr}\int_0^r p_r(w)dw\\ &=p_r(r)\geq 0 \end{split} and \begin{split} p_s(s)&=p_r(r)\left|\frac{dr}{ds}\right|\\ &=p_r(r)\frac{1}{p_r(r)}\\ &=1\quad 0\leq s\leq 1. \end{split}

2.4   Discrete version of $s$

\begin{split} s_k&=T(r_k)\\ &=\sum_{j=0}^k p_r(r_j)\\ &=\sum_{j=0}^k\frac{n_j}{n} \end{split} for $k=0,1,2,\cdots,L-1$.

2.5   Why histogram equalization?

  • Non-parametric image enhancement
  • “Try” to make use of the full gray levels (uniform histogram) $\rightarrow$ High contrast