Quiz: HSV, CIELAB and colour segmentation

Short questions to test your understanding. Try each on paper first, then open the answer. HSV: V = \max, S = (\max - \min)/\max, H = angle around the grey axis (red 0°, green 120°, blue 240°). CIELAB: L^* lightness, a^* green–red, b^* blue–yellow; \Delta E^*_{ab} = Euclidean distance in Lab.


Q1. A red apple is half in shadow. Why does a threshold “R > 120” fail, while “hue near 0° and saturation > 0.4” works?

What does a shadow do to the three channels?

A shadow scales all three channels down by about the same factor. In the shadow R drops below 120, so the threshold cuts the apple in half. Hue and saturation depend only on the ratios of the channels, which the scaling keeps: the shadowed half has the same hue and saturation as the lit half.


Q2. What is the mean hue of two pixels with hues 350° and 10°? What does the ordinary average give?

Draw both on a circle.

Both are reds, 20° apart across 0°: the mean is 0°, red. The ordinary average (350 + 10)/2 = 180° is cyan, the opposite colour. Average the unit vectors (\cos H, \sin H) and take the angle of the result.


Q3. A hue mask for “red” applied to a noisy photo is full of speckles on a grey wall. Why, and what is the fix?

What is the hue of a grey pixel plus a little noise?

For grey the hue is undefined; with a little noise the channels differ slightly and the hue becomes the direction of the noise, which is random: some grey pixels get a “red” hue. Require a minimum saturation (and value): near-grey and dark pixels are then never selected.


Q4. Two colours differ by \Delta E^*_{ab} = 1. Two others differ by \Delta E^*_{ab} = 20. What do you expect to see?

What is a just-noticeable difference in Lab?

\Delta E \approx 1 is at the limit of what can be seen side by side: practically the same colour. \Delta E = 20 is an obvious difference. Lab was built so that distances roughly match perceived differences, so these statements hold anywhere in the space (approximately).


Q5. Two pairs of colours are each 40 code values apart in RGB: two bright yellows, and two dark greens. Which pair looks more different, and what does that say about distances in RGB?

Compare \Delta E: 4.6 and 22.4.

The dark greens (\Delta E = 22.4) look far more different than the yellows (\Delta E = 4.6). Equal distances in RGB are not equal visible differences, so a “ball” of fixed radius in RGB selects very different amounts of visible variation in different parts of the space.


Q6. What are a^* and b^* of any grey, and what is the Lab of the white point?

Lab is relative to the white.

Any grey has a^* = b^* = 0 (it is a scaled white, so the three ratios to the white are equal). The white is (L^*, a^*, b^*) = (100, 0, 0).


Q7. Why is “middle grey” (looks halfway between black and white) only about 18 % of white’s luminance?

L^* uses a cube root.

Perceived lightness grows roughly like the cube root of luminance. L^* = 50 (halfway) needs Y/Y_n with 116\,(Y/Y_n)^{1/3} - 16 = 50, i.e. Y/Y_n \approx 0.18. Conversely, 50 % luminance has L^* = 76: it looks fairly light.


Q8. k-means with k = 2 on the RGB values of a picture of a red apple half in shadow puts the shadowed half of the apple together with the dark background. Why might Lab do better, and why might it still fail?

What does the nearest-centre rule measure?

k-means gives each pixel to the nearest centre. In RGB the dark half of the apple is close to other dark pixels, because brightness dominates all three coordinates. In Lab the colour difference is carried by a^* (strongly positive for red), so the red pixels stay closer to each other. But L^* is still one of the three coordinates: a deep shadow can still move a pixel far from the lit apple. Dropping L^* (clustering in a^*b^* only) or using hue removes that.


Q9. (math) Show that HSV’s hue and saturation do not change when all three channels are multiplied by the same k > 0. What happens to V?

\max, \min and their difference all scale by k.

\max(kR, kG, kB) = k\max, likewise \min and d = \max - \min. S = kd/(k\max) = d/\max, and every case of H is a ratio like (kG - kB)/(kd) = (G - B)/d. Both unchanged; V = k\max scales by k.