Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

TD Active

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Université de Rouen Normandie, INSA de Rouen

M2 Data Science - Science des données

Advanced image processing

Exercice on active contours

We want to approximate the contour of an object in an image by an active contour. We know that
the shape of the object to detect is close to a triangle. Hence we propose to detect the contour of
this object by an active contour, or a "snake" defined by three points x1, x2 and x3. The best
position of the active contour is the one that minimizes an energy function E which is the sum of
an internal energy Eint and an external energy Eext defined by :

E = Eint + Eext

For the sake of simplicity, we assume that the image we want to analyze with the active contour
has already been pre-processed and is now binary. By convention, the pixels belonging to the
object to be detected are at 0 and the pixels belonging to the background are set to 255. Figure 1-a
gives an example of such an image and figure 1-b the approximation obtained with the snake on
this image.

Fig 1-a: Binary image to be segmented Fig 1-b: Segmentation result with a triangle active contour

1) Propose an external energy function that will allow the detection of the object contours by
such a method, ie that will return small values on edges and high values on flat region.

The values of the external energy calculated on a 10x10 binary image is now to defined in the
matrix below:

1
We apply the following algorithm:

1-> Position an initial active contour (which is a triangle) ;


2-> While the global energy of the active contour continues to decrease do :
-> For each point of the active contour do :
-> Search for neighboring pixels of minimum energy (taking into account a 8
neighboring pixels);
-> Move the active contour point to its new position.

The following rules apply:


- the progression step of the points of the active contour is 1 pixel at each iteration;
- if several neighboring pixels have the same minimum energy at step 2 of the algorithm,
one of the pixels is randomly selected;
- if some pixels in the point the neighborhood are defined outside of the image, these
particular pixels are not considered.

2) Give the positions of the successive active contour points until convergence with the
following initialization: x1 = (6,4), x2 = (5,5), x3 = (6,6).
In addition, draw the points on the figure above.

NB: the coordinates of a point correspond to the indices as follows: (6,4) => i=6, j=4
NB2: the internal energy is supposed to be constant.

3) Same question as 2) but with the following initialization:


x1 = (10,2), x2 = (2,5), x3 = (10,6).

4) Why is the result not appropriate?

5) Propose an arithmetic expression for the calculation of the internal energy as a function of
the points x1, x2 and x3 so that this energy is no longer a constant but a function
expressing the fact that:
a) the length of the resulting contour is as short as possible;
b) the final contour is a triangle (two points of the active contour cannot converge to the
same point).

You might also like