Geodesic Segmentation

Important: Please read the installation page for details about how to install the toolboxes. $\newcommand{\dotp}[2]{\langle #1, #2 \rangle}$ $\newcommand{\enscond}[2]{\lbrace #1, #2 \rbrace}$ $\newcommand{\pd}[2]{ \frac{ \partial #1}{\partial #2} }$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\umax}[1]{\underset{#1}{\max}\;}$ $\newcommand{\umin}[1]{\underset{#1}{\min}\;}$ $\newcommand{\uargmin}[1]{\underset{#1}{argmin}\;}$ $\newcommand{\norm}[1]{\|#1\|}$ $\newcommand{\abs}[1]{\left|#1\right|}$ $\newcommand{\choice}[1]{ \left\{ \begin{array}{l} #1 \end{array} \right. }$ $\newcommand{\pa}[1]{\left(#1\right)}$ $\newcommand{\diag}[1]{{diag}\left( #1 \right)}$ $\newcommand{\qandq}{\quad\text{and}\quad}$ $\newcommand{\qwhereq}{\quad\text{where}\quad}$ $\newcommand{\qifq}{ \quad \text{if} \quad }$ $\newcommand{\qarrq}{ \quad \Longrightarrow \quad }$ $\newcommand{\ZZ}{\mathbb{Z}}$ $\newcommand{\CC}{\mathbb{C}}$ $\newcommand{\RR}{\mathbb{R}}$ $\newcommand{\EE}{\mathbb{E}}$ $\newcommand{\Zz}{\mathcal{Z}}$ $\newcommand{\Ww}{\mathcal{W}}$ $\newcommand{\Vv}{\mathcal{V}}$ $\newcommand{\Nn}{\mathcal{N}}$ $\newcommand{\NN}{\mathcal{N}}$ $\newcommand{\Hh}{\mathcal{H}}$ $\newcommand{\Bb}{\mathcal{B}}$ $\newcommand{\Ee}{\mathcal{E}}$ $\newcommand{\Cc}{\mathcal{C}}$ $\newcommand{\Gg}{\mathcal{G}}$ $\newcommand{\Ss}{\mathcal{S}}$ $\newcommand{\Pp}{\mathcal{P}}$ $\newcommand{\Ff}{\mathcal{F}}$ $\newcommand{\Xx}{\mathcal{X}}$ $\newcommand{\Mm}{\mathcal{M}}$ $\newcommand{\Ii}{\mathcal{I}}$ $\newcommand{\Dd}{\mathcal{D}}$ $\newcommand{\Ll}{\mathcal{L}}$ $\newcommand{\Tt}{\mathcal{T}}$ $\newcommand{\si}{\sigma}$ $\newcommand{\al}{\alpha}$ $\newcommand{\la}{\lambda}$ $\newcommand{\ga}{\gamma}$ $\newcommand{\Ga}{\Gamma}$ $\newcommand{\La}{\Lambda}$ $\newcommand{\si}{\sigma}$ $\newcommand{\Si}{\Sigma}$ $\newcommand{\be}{\beta}$ $\newcommand{\de}{\delta}$ $\newcommand{\De}{\Delta}$ $\newcommand{\phi}{\varphi}$ $\newcommand{\th}{\theta}$ $\newcommand{\om}{\omega}$ $\newcommand{\Om}{\Omega}$

This tour explores the use of Fast Marching methods for image segmentation.

In [2]:
addpath('toolbox_signal')
addpath('toolbox_general')
addpath('toolbox_graph')
addpath('solutions/fastmarching_8_segmentation')

Segmentation Using Geodesic Ball

It is possible to extract an object by growing a geodesic ball.

First we load an image.

In [3]:
n = 256;
name = 'cortex';
M = rescale( sum(load_image(name,n),3) );

Display.

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

Starting point of the grodesic ball.

In [5]:
pstart = [154;175];

Choose a metric that is minimal for value of the image close to pstart.

In [6]:
W = abs(M-M(pstart(1),pstart(2)));
W = rescale( max(W,0.03), 0.01,1).^2;

Compute the Fast Marching from the center.

In [7]:
clear options;
options.nb_iter_max = Inf;
options.end_points = [];
[D,S,Q] = perform_fast_marching(1./W, pstart, options);

Exercise 1

Display geodesic balls {x \ M(x)<T} for various T.

In [8]:
exo1()
In [9]:
%% Insert your code here.

Segmentation Using Voronoi Diagrams

It is possible to perform the segmentation by using an edge stopping metric, and Vornoi diagram for several seeds.

Magnitude of the gradient.

In [10]:
mu = 2;
d = sqrt( sum( grad(perform_blurring(M,mu)).^2, 3) ); 
d = perform_blurring(d,mu);

Edge stopping metric.

In [11]:
W = rescale( min(d,0.15), 0.01,1).^2;

Display the metric.

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

Starting points.

In [13]:
pstart = [[30;30] [139;86] [158;170] [128;134] [124;122]];

Perform propagation.

In [14]:
options.nb_iter_max = Inf;
options.end_points = [];
[D,S,Q] = perform_fast_marching(1./W, pstart, options);

Display Voronoi diagrams.

In [15]:
clf;
imageplot(Q);
colormap(jet(256));

Exercise 2

Display the level sets.

In [16]:
exo2()
In [17]:
%% Insert your code here.