Quiz: level sets and marching squares

Short questions to test your understanding. Try each on paper first, then open the answer. A grid point is above when I > c; cell corners 0, 1, 2, 3 = top-left, top-right, bottom-right, bottom-left; case index = \sum 2^k over the corners above c.


Q1. What is the difference between thresholding an image at c and computing its level set at c?

One produces pixels, the other a curve.

Thresholding labels each pixel above or below c: a region made of whole pixels. The level set \{I = c\} is the boundary between those regions, a curve that passes between pixel centres at the interpolated position, with sub-pixel precision.


Q2. A cell has corners (top-left, top-right, bottom-right, bottom-left) = 2, 7, 8, 1 and c = 5. What is its case index, and which edges are crossed?

Which corners are above 5?

Corners 1 and 2 are above: case 2 + 4 = 6. The crossed edges are the top edge (2 → 7) and the bottom edge (8 → 1); the contour runs from top to bottom, like a vertical line.


Q3. On an edge from 30 to 90, where is the crossing for c = 45?

t = (c - I_a)/(I_b - I_a).

t = 15/60 = 0.25: a quarter of the way from the corner with 30.


Q4. Why do the line segments of neighbouring cells always join up, although each cell is handled on its own?

What do the two cells have in common?

They share the edge between them, with the same two corner values: both find the same crossing point (or both find none). So every segment ending on that edge meets the segment of the neighbour there.


Q5. Which cases are ambiguous, and what are the two possible contours?

Look for diagonal corners.

Cases 5 and 10: two diagonal corners above, the other two below. The contour can separate the two bright corners (each cut off on its own) or join them (the two dark corners cut off instead). Both choices give closed curves; they differ in topology.


Q6. A saddle cell has corners 6, 2, 6, 2 (clockwise from top-left) and c = 4. What does the asymptotic decider do?

f^\ast = (I_0 I_2 - I_1 I_3)/(I_0 + I_2 - I_1 - I_3).

f^\ast = (36 - 4)/(12 - 4) = 32/8 = 4 = c: exactly the borderline (with the rule “join if f^\ast > c” it separates). Any change of a value tips the decision. This is the case where the bilinear interpolant’s level curve at c is a pair of crossing lines.


Q7. A noisy image gives 300 contours at c where you expect 5 objects. Name two things you could do, and their side effects.

Change the image, or filter the result.

Blur before extracting (fewer and smoother contours; but small objects shrink and thin necks break), or discard contours enclosing less than a minimum area (keeps the shapes; but real small objects go too, and the remaining boundaries stay ragged). Choosing c further from the noise level also helps.


Q8. (math) Show with the shoelace formula that the triangle (0, 0), (4, 0), (0, 3) has area 6, and that listing its corners in the opposite order gives -6.

A = \tfrac12\sum(x_i y_{i+1} - x_{i+1} y_i).

Terms: (0 \cdot 0 - 4 \cdot 0) + (4 \cdot 3 - 0 \cdot 0) + (0 \cdot 0 - 0 \cdot 3) = 12, so A = 6. Reversed, (0,0), (0,3), (4,0): (0 - 0) + (0 \cdot 0 - 4 \cdot 3) + (0 - 0) = -12, A = -6.