Quiz: active contours (snakes)

Short questions to test your understanding. Try each on paper first, then open the answer. A snake is a closed polygon \mathbf x_0, \dots, \mathbf x_{n-1} with elasticity \alpha, rigidity \beta and an image term from the edge map f = |\nabla(G_\sigma * I)|^2.


Q1. What does a snake give you that a threshold does not?

One closed, smooth curve around one object, as a list of points: no holes, no stray pixels, no leaks through small gaps. Its smoothness is controlled (\alpha, \beta), and the outline directly gives perimeter, curvature and shape. The price: it needs a starting curve near the object, and it finds a local, not a global, best.


Q2. A bead sits at (4, 2); its neighbours are at (2, 4) and (4, 0). With \alpha = 0.5 and \beta = 0, what is the elastic force on it?

\alpha(\mathbf x_{i-1} - 2\mathbf x_i + \mathbf x_{i+1}).

0.5\big((2, 4) + (4, 0) - 2(4, 2)\big) = 0.5\,(-2, 0) = (-1, 0). The neighbours’ midpoint is (3, 2): the force points there, with \alpha times twice the distance.


Q3. A snake is placed in an empty image (no edges at all), with \alpha > 0. What happens?

It shrinks towards a point (its centroid stays put): every bead is pulled towards the midpoint of its neighbours and nothing pulls back. That is why a snake must start around the object (or be inflated by a balloon force, next unit).


Q4. Which parameter would you increase if the snake follows the object well but has small wiggles from noise along its outline: \alpha, \beta or \sigma? Which side effect do you expect?

\beta (rigidity) removes wiggles directly, at the price of rounding real corners; increasing \sigma also helps, by smoothing the noise out of the edge map, at the price of blurred and slightly shifted edges. Increasing \alpha shortens the curve but also pulls it off the edge.


Q5. A bead is 15 pixels away from the nearest edge, with \sigma = 1.5. Why does the image force not move it, and name one way to fix that.

The edge map f is only non-zero within a few \sigma of the edge; 15 pixels away it is flat, so its slope, the image force, is (almost) zero: the bead is outside the capture range. Fixes: a larger \sigma (coarse to fine), a start closer to the object, or a force that reaches further (balloon force, gradient vector flow: next unit).


Q6. The snake zig-zags and explodes after a few dozen steps. What do you change?

The step \tau is too large for the explicit (gradient-descent) update: make it smaller (below 2/\lambda_\text{max}, \lambda_\text{max} = 4\alpha + 16\beta), or use the semi-implicit update, which is stable for any \tau (next unit).


Q7. Why can a snake started around a U-shaped object not follow it into the U?

Inside the U the image force points sideways, to the walls, and nowhere into the opening; the beads across the mouth feel no pull inwards, and the springs keep them on a straight line. The edge force only pulls towards nearby edges.


Q8. (math) Show that for a closed curve the elastic force \alpha\mathbf x'' on the circle \mathbf x(s) = r(\cos s, \sin s) points to the centre with size \alpha r.

\mathbf x'(s) = r(-\sin s, \cos s), \mathbf x''(s) = -r(\cos s, \sin s) = -\mathbf x(s). So \alpha\mathbf x'' = -\alpha\mathbf x: towards the centre, of length \alpha|\mathbf x| = \alpha r. (It is the first-variation term -\alpha\mathbf x'' of the Euler–Lagrange equation, with the sign of a force.)


Q9. (math) Which kernel do you get by applying the second difference [1, -2, 1] twice, and which term of the snake force uses it?

[1, -2, 1] * [1, -2, 1] = [1, -4, 6, -4, 1], a discrete fourth derivative. It is the rigid (bending) force: -\beta(\mathbf x_{i-2} - 4\mathbf x_{i-1} + 6\mathbf x_i - 4\mathbf x_{i+1} + \mathbf x_{i+2}).