Quiz: fast marching
Before this unit: When there is no order: Dijkstra and live-wire (previous unit); Moving a curve: the level set equation (day 31); Day 27: Graph cuts.
See also: Day 30: Snakes and active shape models; Day 13: Morphology; Day 15: Watershed.
Short questions to test your understanding. Try each on paper first, then open the answer. T is the arrival time of a front that starts at the seeds and moves with speed 1/P; fast marching computes it in Dijkstra’s order with the upwind update.
Q1. With a flat cost, why are 4-neighbour Dijkstra distances diamonds, and not circles?
Every path on the 4-neighbour grid is a staircase of horizontal and vertical steps. To reach a point at 45° it needs as many horizontal as vertical steps: the city-block distance |x| + |y|, whose level lines are diamonds. A point 100 px away on the diagonal gets about 141.
Q2. What is the arrival time T when P = 1 everywhere and there is one seed?
The Euclidean distance to the seed: the front moves with speed 1 in every direction, so its fronts are circles. With several seeds: the distance to the nearest seed (a distance transform of the seed set).
Q3. What does fast marching keep from Dijkstra, and what does it change?
It keeps the priority queue and the rule “the smallest tentative value is final”, so the order is found on the fly. It changes the update: instead of the best single neighbour plus a step, it combines the smaller known neighbour along x and along y and solves for the arrival time of a straight front passing both.
Q4. Left neighbour T = 5, upper neighbour T = 5, P = 1. What do Dijkstra (4 neighbours) and fast marching give?
T = \tfrac12\big(a + b + \sqrt{2P^2 - (a - b)^2}\big) if |a - b| < P.
Dijkstra: 6. Fast marching: \tfrac12(10 + \sqrt2) = 5.707: a front arriving diagonally needs only 1/\sqrt2 to cross from the line through the two neighbours to the pixel.
Q5. The cost is P = 1 + (|\nabla I|/k)^2. What happens to the fronts at a strong edge, and what does a larger k do?
At a strong edge P is large, so the front slows down and its iso-lines bunch up there; regions separated by edges are reached late. A larger k makes P smaller for the same gradient: only very strong edges slow the front, and T approaches the plain distance.
Q6. How is the minimal path found from T, and why is it not restricted to grid steps?
By gradient descent on T from the target: small steps against \nabla T (interpolated between pixels) lead down to a seed. The steps can go in any direction and the positions are real numbers, so the path is a smooth curve, not a chain of pixel steps.
Q7. Geodesic active contours (level-set day) and fast marching both deal with a weighted length \int P\, ds. What is the difference?
A geodesic active contour moves a curve downhill from a starting position and stops in a local minimum. Fast marching computes the arrival time from the seeds everywhere and finds the global minimal path between a seed and a target by descending it (up to the discretisation error).
Q8. (math) Show that T(x, y) = (x + y)/\sqrt2 satisfies the upwind update with P = 1 exactly.
The left and upper neighbours have a = b = T - 1/\sqrt2, so |a - b| = 0 < 1 and (T - a)^2 + (T - b)^2 = \tfrac12 + \tfrac12 = 1 = P^2. The update returns T = a + 1/\sqrt2, which is the exact value: plane waves are reproduced exactly.