Heuristically Driven Front Propagation¶


This tour explores the use of heuristics to speed up Fast Marching methods in 2D.

The use of heuristics for the computation of geodesic paths was introduced in

Heuristically Driven Front Propagation for Fast Geodesic Extraction Gabriel Peyre and Laurent Cohen, International Journal for Computational Vision and Biomechanics, Vol. 1(1), p.55-67, Jan-June 2008.

In [2]:
addpath('toolbox_signal')


Ideal Heuristically Driven Front Propagation¶

The ideal heuristic |H| is the remaining distance to the ending point. It is ideal in the sense that it is as difficult to compute this distance than to solve for the original problem of extracting the geodesic.

One can however study the influence of this heuristic by replacing |H| by |weight*H| where |weight<1| is a sub-optimality factor.

In [3]:
n = 300;


Display it.

In [4]:
clf;
imageplot(M);


Define start and end points (you can use your own points).

In [5]:
pstart = [14;161];
pend = [293;148];


Compute a metric to extact the road.

In [6]:
W = abs(M-M(pstart(1),pstart(2)));
W = rescale(W, 1e-2,1);


Display it.

In [7]:
clf;
imageplot(W);


Perform the full propagation.

In [8]:
[D,S] = perform_fast_marching(1./W, pstart);


Extract a geodesic curve.

In [9]:
p = compute_geodesic(D,pend);


Display the distance and the geodesic curve.

In [10]:
clf; hold on;
imageplot(convert_distance_color(D,M), 'Distance');
h = plot(p(2,:),p(1,:), '.k'); set(h, 'LineWidth', 2);
h = plot(pstart(2),pstart(1), '.r'); set(h, 'MarkerSize', 25);
h = plot(pend(2),pend(1), '.b'); set(h, 'MarkerSize', 25);
axis ij;


Compute the heuristic.

In [11]:
[H,S] = perform_fast_marching(1./W, pend);


Display the ideal heuristic function.

In [12]:
clf; hold on;
imageplot(convert_distance_color(H,M), 'Distance');
h = plot(p(2,:),p(1,:), '.k'); set(h, 'LineWidth', 2);
h = plot(pstart(2),pstart(1), '.r'); set(h, 'MarkerSize', 25);
h = plot(pend(2),pend(1), '.b'); set(h, 'MarkerSize', 25);
axis ij;


Exercise 1

Display the set of points satisfying |D+H<=T| for several value of the threshold |T>=D(pend)|. What do you observe ?

In [13]:
exo1()

In [14]:
%% Insert your code here.


Perform the heuristically driven propagation.

In [15]:
weight = .9;
options.end_points = pend;
options.heuristic = weight*H;
options.nb_iter_max = Inf;
options.constraint_map = Inf+zeros(n);
[D,S] = perform_fast_marching(1./W, pstart, options);


Display the region explored by the algorithm.

In [16]:
I = find(S<0);
U = cat(3,M,M,M);
U(I) = 1; U([I+n^2, I+2*n^2]) = U([I+n^2, I+2*n^2])*.3;
clf; hold on;
imageplot(U);
h = plot(p(2,:),p(1,:), '.k'); set(h, 'LineWidth', 2);
h = plot(pstart(2),pstart(1), '.g'); set(h, 'MarkerSize', 25);
h = plot(pend(2),pend(1), '.b'); set(h, 'MarkerSize', 25);
axis ij;


Exercise 2

Display the explored region for different values of |weight|.

In [17]:
exo2()