The image you have been given for contour extraction is shown in Figure 1. The method for constructing the search space is shown in Figure 2. It is generated from two initial discrete contours (shown in red). (The example shown here has N = 4 points on each contour for clarity, but the example you are given has many more points.) The search space is formed by joining the corresponding points on the two red contours with lines (shown in green). These green lines are then subdivided equally into M points to provide a discrete M N search space, of which there are MN possible contours. The aim of the algorithm is to nd the contour which has points of highest intensity along it and is smooth. The constraints are that each line must pass through one green point per line and it cannot move back on itself. An example of an optimal contour in this case is shown in brown and an example of a non-optimal contour is shown in yellow. The problem with such a technique is that the large size of the search space demands a high computational overhead. However, the local connectivity of the contour energy function can be exploited, reducing the computation from exponential to polynomial time. The method of Dynamic Programming (Bellman, 1957) will be employed, which is based around the principle of optimality. The principle states (Sonka et al., 1993): Whatever the path to a node X, there exists an optimal path between X and the end point. In other words if the optimal path (start point to end point) goes through X then both its parts start point to X and X to end are also optimal.