words, pixels with gray levels less than or equal to the threshold $t$ are assigned to $\mathcal{C}_0$, whereas the remaining pixels are assigned to $\mathcal{C}_1$.

Let $n_i$ be the number of pixels with gray level $i$. The total number of pixels in the image is then given by $n = \sum\nolimits_{i = 0}^{L - 1}{n_i}$. The normalized gray level histogram of the image can be regarded as a probability mass function: $$p_i = \frac{n_i}{n},\quad p_i \ge 0,\quad \sum\limits_{i = 0}^{L - 1} {p_i}  = 1$$

Let $p_0(t) = \sum\nolimits_{i = 0}^t {p_i}$ and $p_1(t) = 1 - p_0(t)$ denote the probabilities of $\mathcal{C}_0$ and $\mathcal{C}_1$, respectively. The means of the respective classes are then given by: $$\begin{array}{l}
 \mu _0 (t) = {{\mu (t)} \mathord{\left/
 {\vphantom {{\mu (t)} {p_0 (t)}}} \right.
 \kern-\nulldelimiterspace} {p_0 (t)}} \\
 \mu _1 (t) = {{\left( {\mu _T  - \mu (t)} \right)} \mathord{\left/
 {\vphantom {{\left( {\mu _T  - \mu (t)} \right)} {p_1 (t)}}} \right.
 \kern-\nulldelimiterspace} {p_1 (t)}} \\
 \end{array}$$ where $\mu(t) = \sum\nolimits_{i = 0}^t {ip_i}$ and $\mu_T  = \mu(L - 1)$ denote the first moment of the histogram up to gray level $t$ and mean gray level of the image, respectively.

Otsu’s method adopts between-class variance, 