In the following you can find code for segmentation based on geometric/geodesic active contours. Implementations are based on the following papers:

- A Geometric Model for Active Contours, Caselles et al. 1993
- Geodesic Active Contours, Caselles et al. 1997

Formulations for both the models are as follows:

\[ \Phi_t = |\nabla \Phi| DIV \Big( \dfrac{g(I)}{|\nabla \Phi|} \nabla \Phi \Big) + g(I) |\nabla \Phi| c \]

\[ \Phi_t = |\nabla \Phi| DIV \Big( \dfrac{g(I)}{|\nabla \Phi|} \nabla \Phi \Big) + \nabla g(I) \cdot \nabla \Phi \]

where \( \Phi \) is a level-set function defining the segment, \( g(I) \) is a `stopping' function, \( I \) is the image and \( c \) is a `balloon' force constant.

Segmentation results for an image from the DRIVSO project.

Model 1. is the geometric model, while model 2. is the geodesic model. In this case, partly due to diffusion, obtained results are similar. Typically, however, the geodesic model can be considered more stable. The reason for applying the diffusion before segmenting is related to the scale-space theory: in this case we only want to find the `big meaningful objects'.

Download Matlab/MEX code for active contours