**Name**

**segct** Region-Growing method using the energy model of Mumford and Shah with piecewise constant approximation function

**Command Synopsis**

**segct** [-S *size_of_grid*] [-N *nb_of_regions*] [-L *lambda*] [-c *curves*] [-r *reconstruction*] *.* *.* *fimage* *boundary*

-Ssize_of_grid: size of initilization grid (int), default 1

-Nnb_of_regions: number of desired regions (int)

-Llambda: value of final scale parameter (float) of last 2-normal segmentation

-ccurves: output boundary set in curves format

-rreconstruction: output piecewise constant reconstruction

. (screen output) : final number of regions

. (screen output) : final lambda value

fimage: original image

boundary: b/w image of boundary set

**Function Summary**

Cimage segct (sgrid , nb_of_regions , lambda , curves , u , f_nb_of_regions , f_lambda , image_org )

int *sgrid , *nb_of_regions , *f_nb_of_regions ;

float *lambda , *f_lambda ;

Fimage image_org , u ;

Curves curves ;

**Description**

The command **segct** generates, starting from *fimage*,
a 2-normal segmentation
of this picture as will be described below.

The initial picture is broken in a grid of elementary cells, composed of
*D*×*D*-pixel squares (*D*=*size_of_grid*).
We use a classical region-growing algorithm to achieve the partition of the
image in homogeneous regions.

The criterion which measures the resemblance of regions is given by the
Mumford and Shah model [MS95].
Call *g* the picture defined on an open rectangle *R*,
*u* a piecewise constant function, which aim is to approximate *g*, and
let *B* be the boundaries between the regions, i.e. the set of jump points of
*u*. With Mumford and Shah we introduce the following functional which has
to be minimized

The property of being 2-normal for a segmentation of

((*O*_{i}, *O*_{j})) | *u*_{i} - *u*_{j}|^{2},

where |.| denotes the surface measure and
The algorithm proceeds as follows.
The initial picture is partitioned in squares of side *size_of_grid*
pixels.
Construct a list of the corresponding
symbolic regions containing all the information needed (surface, sum
of gray-levels in the square, length of boundaries).
Construct a table in which to each boundary is associated the
value of for which this boundary will disappear (i.e.
*E* decreases by merging the two adjacent regions).
Using and updating this ``merit'' table the algorithm proceeds.
The information on the new region, constructed when a merging decision occurred,
is taken
from the two old one's, so there is no need to return on pixel level.

There are two (incompatible) options : either one wants the segmentation
to stop at *nb_of_regions* regions or the final segmentation is
at scale *lambda*.

If the first option is chosen the program stops when the desired
number of regions (*nb_of_regions*)
is reached. To be more precise it stops at the value of for which this
particular number of regions is reached, there might be less regions
remaining if *nb_of_regions* doesn't correspond to a 2-normal segmentation
for any .

In case the final is fixed the program stops at *lambda* or
for the value of just lower than *lambda*. For example if
*lambda*=13.45 and the current =13.09, then if the next
boundary in the segmentation will vanish for =14.67 the program
stops. The obtained segmentation is also valid for each strictly
lower than the next value .

If the program is used as module in another program the final values of and the number of regions are passed to the corresponding variables. On command line execution this information is anyway displayed.

The program estimates the memory used by the process, this mainly depends
on the precision of the initial grid, for example *D* = 1 is the best possible
precision, but it needs a lot of memory for the data structure
(1 pixel = 1 region). So the program turns out to be most efficient
(i.e. fast) on machines with a big amount of central memory. Indeed as there
is no previous information on the picture available and as regions can grow
in any direction, the whole structure should be available in central memory.

The output shows the initial quadratic error, the total boundary length and
the number of regions the algorithm starts with, after reaching
*nb_of_regions* the quadratic error, boundary length, number of region
and the current value of .

The output is file *boundary* which represents the boundary set
on a white background and is stored under `cimage`-format.

An optional output is file *curves*
which contains the boundary set under
`curve`-format (use **-c**).
Using **curves_cimage** the result can be visualized
on the original *fimage* for example.

To obtain the gray-level reconstruction of
the piecewise constant approximation use **-r**.
This will write an `fimage`
in file *reconstruction*.

**Version 1.21**

Last Modification date : Thu Nov 29 20:23:56 2001

**Author**

Georges Koepfler