Quiz: moments as projections onto monomials

Before this unit: Day 14: Labelling.

See also: Day 33: Random forests.

Short questions to test your understanding. Try each on paper first, then open the answer. Moments: m_{pq} = \sum x^p y^q I(x, y); central moments \mu_{pq} use x - \bar x, y - \bar y; x to the right, y down.


Q1. For a binary mask, m_{00} is the area. What is m_{00} of a grey image, and what is its centroid (m_{10}/m_{00}, m_{01}/m_{00})?

The weight of every pixel is its grey value.

m_{00} is the total intensity (the sum of all grey values). The centroid is the intensity-weighted mean position, the “centre of mass” if grey value is mass. It moves towards the bright parts.


Q2. How many moments m_{pq} are there with p + q \le 3? With p + q \le 10?

Order k has k + 1 moments: (k, 0), (k-1, 1), \dots, (0, k).

1 + 2 + 3 + 4 = 10 up to order 3. Up to order 10: (N+1)(N+2)/2 = 11 \cdot 12/2 = 66.


Q3. A shape has \mu_{30} = +115 (per pixel of mass). You mirror it left–right. What happens to \mu_{30}, \mu_{20} and \mu_{21}?

Mirroring replaces x - \bar x by -(x - \bar x).

\mu_{pq} is multiplied by (-1)^p. \mu_{30} \to -115 (odd in x), \mu_{20} unchanged (even), \mu_{21} unchanged (p = 2 is even). The skewness along x flips sign: the shape now leans the other way.


Q4. A square and a disc have the same covariance matrix S. Which moment tells them apart first, and which shape has the larger value?

Both are symmetric under x \to -x: what does that do to every odd-order central moment?

All odd orders are zero for both (point symmetric), order 2 is equal by assumption, so order 4 is the first difference. The kurtosis of the marginal is 1.8 for the square (flat, uniform) and 2.0 for the disc (a half-ellipse, more mass near the middle): the disc’s is larger.


Q5. Why should coordinates be mapped to [-1, 1] before computing moments up to order 10?

How large is x^{10} for x = 255, and how many significant digits does a double have?

255^{10} \approx 1.2 \times 10^{24}. A double carries about 16 significant digits, so in a sum of such terms everything below about 10^{8} is rounded away, and differences of large terms (central moments) lose most of their digits. In [-1, 1] every weight is at most 1.


Q6. A single pixel is counted as a point at its centre, or as a unit square. What is its \mu_{20} in each case? What does the square model add to \mu_{20} of an object of 548 pixels?

\int_{-1/2}^{1/2} t^2\,dt.

As a point: 0 (all mass at the centroid). As a square: \int_{-1/2}^{1/2} t^2\,dt = 1/12 \approx 0.083. Every pixel adds 1/12, so the object’s \mu_{20} grows by 548/12 = 45.7, i.e. \mu_{20}/m_{00} by exactly 1/12 (from 63.498 to 63.582 for the pear in the demo).


Q7. The equivalent ellipse of an L-shaped object is tilted. Which order of moments first tells you in which corner the L has its “elbow”?

An ellipse is point symmetric.

Order 3. Everything up to order 2 is the same for the L and its 180°-rotated copy (and for the ellipse); rotating by 180° flips the sign of every odd-order central moment. The signs of \mu_{30}, \mu_{03}, \mu_{21}, \mu_{12} say on which side the extra mass lies.


Q8. (math) F(u, v) is the Fourier transform of f. Which moment is F(0, 0), and which is \partial^2 F/\partial u^2 at the origin?

Differentiate e^{-2\pi i(ux + vy)} under the integral.

F(0, 0) = \iint f = m_{00}. \partial^2 F/\partial u^2 = \iint (-2\pi i x)^2 f\, e^{\dots}, at the origin -4\pi^2 m_{20}. Moments are the derivatives of the spectrum at zero frequency.


Q9. Why can’t five or ten moments in general reproduce an image exactly, even though all moments determine it?

How many numbers does a 64 \times 64 image have?

A 64 \times 64 image has 4096 values; ten numbers cannot pin them down. In frequency terms: low-order moments fix the spectrum only near zero frequency, so fine detail (high frequencies) is not determined.