Quiz: choosing the threshold from the histogram
Before this unit: Histograms & a global threshold (previous unit); Day 1: Images, filters and frequencies.
See also: Day 3: Bit depth and noise; Day 2: Edges, blobs and ridges.
Short questions to test your understanding. Try each on paper first, then open the answer. Class 0 is background (i \le t), class 1 is object; \omega_k, \mu_k, \sigma_k^2 are the class weights, means and variances.
Q1. Why is minimising the within-class variance the same as maximising the between-class variance?
What happens to the total variance when t moves?
Total = within + between, and the total variance of all pixels does not depend on t. Whatever the within part loses, the between part gains.
Q2. Two splits have class means 40 and 200. In split A the classes hold 50 % and 50 % of the pixels; in split B 99 % and 1 %. Which has the larger \sigma_B^2, and by how much?
\sigma_B^2 = \omega_0\omega_1(\mu_0 - \mu_1)^2.
A: 0.25 \cdot 160^2 = 6400. B: 0.0099 \cdot 160^2 = 253. A is about 25 times larger: Otsu prefers splits where both classes are substantial.
Q3. One isodata step: the current split has class means 60 and 140. Where does the threshold go next? When does isodata stop?
Midpoint.
To (60 + 140)/2 = 100. It stops when the new midpoint gives the same split as before: every pixel is then nearer to its own class mean (a fixed point, as in k-means with k = 2).
Q4. Objects are rare (5 % of the pixels) and both classes have the same spread. Is the minimum-error threshold above or below the midpoint of the two means?
At the midpoint, which class is more likely for a pixel?
Above (towards the object mean). At the midpoint both densities are equal, but background is 19 times more common, so a pixel there is probably background. The boundary moves towards the rarer class until the weighted densities are equal.
Q5. Why can the minimum-error rule with unequal variances label a pixel object when it is darker than the background mean?
Compare the tails of a narrow and a wide normal curve.
If the object class is much wider, its density decays more slowly than the narrow background peak, so far below the background mean the object density is larger again. The weighted curves cross twice, and the Bayes rule says “object” in both tails. (In practice that dark tail holds very few pixels.)
Q6. A fluorescence image has a huge dark background peak and a faint tail of a few bright spots, with no valley. Which method would you try first, and why does Otsu fail?
Otsu needs both classes to be substantial.
The triangle method (or maximum entropy): it is made for a unimodal histogram with a long tail and puts t where the peak ends. Otsu’s \sigma_B^2 barely rewards separating a 1 % class, so it splits the background peak instead.
Q7. Two classes overlap so much that the best possible threshold misclassifies 20 % of the pixels. Will a cleverer histogram method do better?
What information does any histogram method use?
No. The Bayes threshold is already the best rule that looks at one grey level at a time. To do better you need more information than the grey level of a single pixel: its neighbours (smoothing, graph cuts) or other features.
Q8. (math) Show that \mu_0 - \mu = \omega_1(\mu_0 - \mu_1).
\mu = \omega_0\mu_0 + \omega_1\mu_1 and \omega_0 = 1 - \omega_1.
\mu_0 - \mu = \mu_0 - (1 - \omega_1)\mu_0 - \omega_1\mu_1 = \omega_1\mu_0 - \omega_1\mu_1 = \omega_1(\mu_0 - \mu_1).