Quiz: region properties and moments

Short questions to test your understanding. Try each on paper first, then open the answer. Coordinates: x = column, y = row (down); orientations are counter-clockwise as seen on the screen.


Q1. Why can area, centroid and second moments of all objects be computed in a single scan of the label image?

What kind of quantity is each of them?

They are sums over the pixels of an object (\sum 1, \sum x, \sum y, \sum x^2, \sum xy, \sum y^2). Keep one set of running sums per label and add each pixel to the sums of its label. Central moments follow from the raw sums afterwards.


Q2. You measure the perimeter of digitised discs by counting pixel edges, at higher and higher resolution. Does the estimate converge to 2\pi r?

How long is a staircase compared with the straight line it follows?

No. A staircase is as long as its horizontal plus vertical legs, however fine its steps. Averaged over all directions of a circle this is 4/\pi \approx 1.27 times the true length: the edge count tends to 8r, not 2\pi r.


Q3. What do the eigenvectors and eigenvalues of the second-moment matrix S of an object tell you?

Treat the pixels as a cloud of points (the PCA unit).

The eigenvectors are the principal axes of the pixel cloud: \mathbf v_1 points along the direction in which the object is longest (its orientation), \mathbf v_2 across it. The eigenvalues are the variances of the pixel coordinates along these axes; the equivalent ellipse has semi-axes 2\sqrt{\lambda_1} and 2\sqrt{\lambda_2}.


Q4. An object is rotated by 30°. Which of these change: S, \lambda_1, \lambda_2, the orientation, the eccentricity?

S = Q\Lambda Q^\top.

S and the orientation change (the orientation by 30°). \lambda_1, \lambda_2 and the eccentricity do not: rotation turns the eigenvectors and keeps the eigenvalues (up to small digitisation changes).


Q5. A program reports the orientation of a square as 0°, and of the same square rotated by 20° also as 0°. Is it broken?

Compare the two eigenvalues of a square.

No. A square has \lambda_1 = \lambda_2, like a disc: every direction is a principal axis, and the second moments cannot see any orientation. The reported angle is arbitrary and should not be used.


Q6. An L-shaped object and a solid ellipse have the same equivalent ellipse. What does that say about the equivalent ellipse?

How many numbers define it?

The ellipse is fixed by six numbers (area, centroid, the three entries of S). Many different shapes share them: it summarises the spread of the pixels, not the outline. Shape features beyond moments (next unit) tell the L and the ellipse apart.


Q7. What is the Euler number of: a ring; the digit 8; two separate discs; a disc with three holes?

Objects minus holes.

Ring: 1 - 1 = 0. Digit 8: 1 - 2 = -1. Two discs: 2 - 0 = 2. Disc with three holes: 1 - 3 = -2.


Q8. Why is it surprising that the Euler number can be computed from 2 \times 2 windows alone?

Counting objects or holes seems to need global information.

Whether two far-apart pixels belong to the same object is a global question, so counting objects or holes separately needs labelling. Their difference is a topological invariant that is a sum of local contributions (Euler’s formula V - E + F), so a single scan over 2 \times 2 windows suffices.


Q9. (math) Show that \mu_{20} = m_{20} - m_{10}^2/m_{00}.

Expand (x - \bar x)^2.

\mu_{20} = \sum (x^2 - 2x\bar x + \bar x^2) = m_{20} - 2\bar x m_{10} + \bar x^2 m_{00}. With \bar x = m_{10}/m_{00}: m_{20} - 2m_{10}^2/m_{00} + m_{10}^2/m_{00} = m_{20} - m_{10}^2/m_{00}.