Quiz: histograms and a global threshold

Short questions to test your understanding. Try each on paper first, then open the answer. Object pixels are those with I(x) > t; p_i is the normalised histogram and P(t) the cumulative histogram.


Q1. An image has N = 10\,000 pixels, and 400 of them have grey level 200. What is p_{200}? What does it mean in words?

Divide by the number of pixels.

p_{200} = 400/10\,000 = 0.04: a pixel chosen at random has grey level 200 with probability 4 %.


Q2. P(120) = 0.85. Which fraction of the image does the threshold t = 120 call object?

P(t) counts the pixels at or below t.

1 - P(120) = 0.15: 15 % of the pixels are brighter than 120 and become object.


Q3. Two images have exactly the same histogram. Must a histogram-based threshold give masks of the same shape? Of the same area?

What does a histogram remember about the pixels?

Same area, yes: the threshold is the same and the area is 1 - P(t). Same shape, no: the histogram forgets where the pixels are, so one image may contain round blobs and the other scattered noise with the same grey levels.


Q4. The valley of a histogram is deep and wide between 90 and 140. Why does it hardly matter where in the valley you put t?

When t moves up by one grey level, which pixels change label?

Only the pixels with grey level exactly at the threshold change label, and in a deep valley there are almost none. The mask (and its area) stays nearly the same for every t in the valley.


Q5. You add noise to a bimodal image. What happens to the two peaks and the valley, and what does the mask look like?

Each pixel moves up or down by a random amount.

Both peaks get wider, overlap, and the valley fills up. Pixels whose noise pushes them across t are misclassified one by one: isolated wrong pixels (salt and pepper) in the object and in the background.


Q6. A 5 \times 5 mean filter is applied before thresholding. By which factor does it reduce the noise, and what is the price?

An average of n independent values.

It averages 25 pixels, so the noise standard deviation drops by \sqrt{25} = 5. The price: edges are blurred over about 5 pixels, so boundary pixels become mixtures (partial volume), small objects lose contrast, and the boundary of the mask is less precise.


Q7. A 16-bit image from a 12-bit camera uses grey levels 100–3900. Why is a histogram with 256 bins over 0–65 535 a poor choice?

Compute the bin width.

Each bin is 256 grey levels wide, so all the data fall into about 15 bins: the peaks merge and the valley is invisible. Use bins over the range of the data (e.g. 256 bins over 100–3900) or one bin per grey level.


Q8. (math) Show that the mean grey level of the image equals \sum_i i\, p_i.

Group the pixels by grey level.

\frac1N \sum_{\text{pixels } x} I(x) = \frac1N \sum_i i \cdot h_i = \sum_i i\,\frac{h_i}{N} = \sum_i i\,p_i: summing over pixels is the same as summing over grey levels, each counted h_i times.