up to Schedule & Notes

Otsu's Method

This method minimizes the within-class variance (i.e. the WCSS), but more efficiently than the two-means method described above.

Minimizing the WCSS (also denoted $\sigma^2_\textrm{within}$) is equivalent to maximizing the "between-class variance", denoted $\sigma^2_\textrm{between}$:

$\begin{array}{rl} \sigma^2_\textrm{between} & = \sigma^2 - \sigma^2_\textrm{within} \\ & \Bigg\downarrow \;\; (\textrm{math}) \\ & = N_1 \; N_2 \: (\mu_1 - \mu_2)^2 \end{array}$

Algorithm 1 (inefficient):

But this takes ${\cal O}( n^2 )$ time for $n$ possible intensity values.

Algorithm 2 (Otsu's Method):

Do this incrementally.

Let $n_1(T)$ = number of pixels with intensity less than $T$.

Let $n_2(T)$ = number of pixels with intensity at least $T$.

Let $n_T$ = number of pixels with intensity equal to $T$.

Let $\mu_1(T)$ = mean of the pixels with intensity less than $T$.

Let $\mu_2(T)$ = mean of the pixels with intensity at least $T$.

Then

$\displaystyle n_1(T+1) = n_1(T) + n_T \\ n_2(T+1) = n_2(T) - n_T \\ \\ \mu_1(T+1) = {\displaystyle n_1(T) \mu_1(T) + n_T T \over \displaystyle n_1(T+1) } \\ \mu_2(T+1) = {\displaystyle n_2(T) \mu_2(T) - n_T T \over \displaystyle n_2(T+1) } \\ $

The algorithm:

This take ${\cal O}( n )$ time for $n$ possible intensity values.

See also www.labbookpages.co.uk/software/imgProc/otsuThreshold.html


up to Schedule & Notes