You are on page 1of 39

Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Statistical Gaussian Model of Image Regions

in Stochastic Watershed Segmentation

Jess Angulo
jesus.angulo@mines-paristech.fr ; http://cmm.ensmp.fr/angulo

MINES ParisTech, PSL-Research University,


CMM-Centre de Morphologie Mathmatique

GSI'2015 - 2nd Conference on Geometric Science of Information


Ecole Polytechnique, Paris-Saclay (France) - October 28th-30th 2015

1 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Motivation: Unsupervised segmentation of generic

images

Custard: Color image

Large homogenous areas, well contrasted objects as well as textured zones


and fuzzy boundaries
2 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Motivation: Unsupervised segmentation of generic

images

Custard: its color gradient image

Large homogenous areas, well contrasted objects as well as textured zones


and fuzzy boundaries
3 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Motivation: Unsupervised segmentation of generic

images

Custard: pdf of contours using stochastic watershed

Using watershed based techniques large homogeneous areas are


oversegmented and textured zones are not always well contoured
4 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Motivation: Unsupervised segmentation of generic

images

Custard: h-dynamics watershed cut from SW pdf, h = 0.1

Using watershed based techniques large homogeneous areas are


oversegmented and textured zones are not always well contoured
5 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Motivation: Unsupervised segmentation of generic

images

Custard: h-dynamics watershed cut from SW pdf, h = 0.3

Using watershed based techniques large homogeneous areas are


oversegmented and textured zones are not always well contoured
6 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Context and goal

7 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Context and goal

Context:
Segmentation approaches based on statistical modeling of pixels and
regions, e.g, mean shift and statistical region merging
Hierarchical contour detection and segmentation, e.g., machine
learned edge detection, watershed transform
Stochastic watershed (SW): to estimate a probability density
function of contours

7 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Context and goal

Context:
Segmentation approaches based on statistical modeling of pixels and
regions, e.g, mean shift and statistical region merging
Hierarchical contour detection and segmentation, e.g., machine
learned edge detection, watershed transform
Stochastic watershed (SW): to estimate a probability density
function of contours

Goal: Take into account regional information in the probability


estimation by SW by means of a statistical gaussian model More
perceptual strength function of contours

7 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation

Plan

1 Stochastic Watershed using MonteCarlo Simulations

2 Multivariate Gaussian Model of Regions in SW

3 Perspectives

8 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

1 Stochastic Watershed using MonteCarlo Simulations

2 Multivariate Gaussian Model of Regions in SW

3 Perspectives

9 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Regionalized Poisson points

Uniform random germs

Generate realizations of a Poisson point process with a constant


intensity (i.e., average number of points per unit area)

Random number of points N(D) falling in a domain D (bounded


Borel set), with area |D|, follows a Poisson distribution with
parameter |D|, i.e.,

n
(|D|)
Pr{N(D) = n} = e |D|
n!
Conditionally to the fact that N(D) = n, the n points are
independently and uniformly distributed over D , and the average
number of points in D is |D| (i.e., the mean and variance of a
Poisson distribution is its parameter

10 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Regionalized Poisson points

Regionalized random germs

Let us suppose that the density is not constant; but considered as


measurable positive-valued function, dened in Rd . For simplicity,
(x)d x
R
let us write (D) =
Number of points falling in a Borel set B according to a regionalized
density function follows a Poisson distribution of parameter (D),
i.e.,
n
((D))
Pr{N(D) = n} = e (D)
n!
If N(D) = n, the n are independently distributed over D with the
probability density function:

b x) = (x)/(D)
(

11 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Regionalized Poisson points

Generate N random germs in an image m : E {0, 1} according to

density (x)
b using inverse transform sampling

1 Initialization: m(xi ) = 0 xi E ; P = Card(E )


P
(x
b k)
2 Compute cumulative distribution function: cdf (xi ) = ki
PP
k=1
(x
b k)

3 for j =1 to N
4 rj U (1, P)
5 Find the value sj such that rj cdf (xsj ) .

6 m(xsj ) = 1

12 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Stochastic watershed paradigm

Spreading random germs as markers on the watershed segmentation.


This arbitrary choice is stochastically balanced by the use of a given
number M of realizations, in order to lter out non signicant
uctuations

Each piece of contour may then be assigned the number of times it


appears during the various simulations in order to estimate a
probability density function (pdf ) of contours

In the case of uniformly distributed random germs, large regions will


be sampled more frequently than smaller regions and will be selected
more often

Image gradient as density for regionalization of random germs


involves sampling high contrasted image areas: probability of
selecting a contour will oer a trade-o between strength of the
contours and size of the adjacent regions

13 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Probability density of contours using MonteCarlo

simulations of watershed

Let {mrkn (x)}M


n=1 be a series of M realizations of N spatially
distributed random markers according to its gradient image g
Each realization of random germs considered as the marker image
for a watershed segmentation of gradient image g in order to obtain
the binary image:

1 if x Watershed lines
WS(g , mrkn )(x) =
0 if x/ Watershed lines

Probability density function of contours is computed by the kernel


density estimation method:

M
1 X
pdf (x) = WS(g , mrkn )(x) K (x).
M n=1

where the smoothing kernel K (x) is a spatial Gaussian function of


width
14 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Probability density of contours using MonteCarlo

simulations of watershed

Color image f (x) Color gradient g (x)

15 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Probability density of contours using MonteCarlo

simulations of watershed

{mrkn (x)}M
n=1 : M realizations of N regionalized Poisson points of
(x) = g (x)

{WS(g , mrkn )}1nM : Watershed segmentations

16 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Probability density of contours using MonteCarlo

simulations of watershed

Color image f (x) Color gradient g (x)

Density of contours pdf (x) Segmented with h = 0.1

17 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Stochastic Watershed using MonteCarlo Simulations

Probability density of contours using MonteCarlo

simulations of watershed

Color image f (x) Color gradient g (x)

Density of contours pdf (x) Segmented with h = 0.3

18 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

1 Stochastic Watershed using MonteCarlo Simulations

2 Multivariate Gaussian Model of Regions in SW

3 Perspectives

19 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Watershed transform Tessellation

Tessellation of E from watershed WS(x): (Finite) family of disjoint


open sets (or classes, or regions)

= {Rr }1r N , with i 6= j Ri Rj =


such that
[
E = r Rr WS(x) WS(x) = E \ r Rr = li,j

Boundary between regions Ri and Rj (1 i, j N , i 6= j): Irregular arc


segment
li,j = Ri Rj
20 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Color regions as multivariate normal distributions

The color image values restricted to each region of the partition,


Pi = f (Ri ), can be modeled by dierent statistical distributions

Here we focuss on a multivariate normal model

Pi N (i , i ),

of mean i and covariance matrix i


Dierent (statistical) distances are dened in the space of N (i , i )
Boundary li,j will be weighted with a function depending on the
distance between N (i , i ) and N (j , j )

21 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Distances for multivariate normal distributions

Bhattacharyya distance DB (P1 , P2 )


It measures the similarity of two discrete or continuous probability
distributions P1 and P2 by computing the amount of overlap
between the two statistical populations:
Z p
DB (P1 , P2 ) = log P1 (x)P2 (x)dx

For multivariate normal distributions


 
1 1 det
DB (P1 , P2 ) = (1 2 )T 1 (1 2 )+ log ,
8 2 det 1 det 2

where
1 + 2
=
2

Note that the rst term in the Bhattacharyya distance is related to


the Mahalanobis distance, both are the same when the covariance of
both distributions is the same
22 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Distances for multivariate normal distributions

Hellinger metric distance DH (P1 , P2 )


0 DB and it is symmetric DB (P1 , P2 ), but DB does not obey
the triangle inequality and therefore it is not a metric

Bhattacharyya distance can be metrized by transforming it into to


the following Hellinger metric distance
p
DH (P1 , P2 ) = 1 exp (DB (P1 , P2 )),

For multivariate normal distributions


s
 1/2
det 1
DH (P1 , P2 ) = 1 e ( 4 (1 2 ) 1 +2 )1 (1 2 ))
T (

det 1 det 2

Hellinger distance is an -divergence, which corresponds to the case


=0 and it is the solely being a metric distance. Hellinger distance
can be related to measure theory and asymptotic statistics

23 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Distances for multivariate normal distributions

Wasserstein metric distance DW (P1 , P2 )


Wasserstein metric is a distance function dened between probability
measures and on Rn is based on the notion optimal transport:

W2 (, ) = inf E(kX Y k2 )1/2 ,


where the inmum runs over all random vectors (X , Y ) Rn Rn
with X and Y
For the case of discrete distributions, it corresponds to the
well-known earth mover's distance
For two multivariate normal distributions:
q
DW (P1 , P2 ) = k1 2 k2 + Tr (1 + 2 21,2 ),
where
 1/2
1/2 1/2
1,2 = 1 2 1 .

In particular, in the commutative case 1 2 = 2 1 one has

2 2 1/2 1 /2 2
DW (P1 , P2 ) = k1 2 k + k 1 2 k .
F 24 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

25 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

To assign to each piece of contour li,j between regions Ri and Rj the


normalized statistical distance between the color gaussian
distributions Pi and Pj :
D(Pi , Pj )
i,j = P ,
lk,l WS D(Pk , Pl )

where D(Pi , Pj ) is any of the distances discussed above

25 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

To assign to each piece of contour li,j between regions Ri and Rj the


normalized statistical distance between the color gaussian
distributions Pi and Pj :
D(Pi , Pj )
i,j = P ,
lk,l WS D(Pk , Pl )

where D(Pi , Pj ) is any of the distances discussed above


For any realization n of SW, denoted WS(x, n), one can compute an
image of weighted contours:
n

i,j if x li,j
Pr (x, n) = n
0 if x/ li,j

25 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

To assign to each piece of contour li,j between regions Ri and Rj the


normalized statistical distance between the color gaussian
distributions Pi and Pj :
D(Pi , Pj )
i,j = P ,
lk,l WS D(Pk , Pl )

where D(Pi , Pj ) is any of the distances discussed above


For any realization n of SW, denoted WS(x, n), one can compute an
image of weighted contours:
n

i,j if x li,j
Pr (x, n) = n
0 if x/ li,j
Integrating across the M realizations, the MonteCarlo estimate of
the probability density function of contours:

M
1 X
pdf (x) = Pr (x, n) K (x)
M n=1

25 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

{WS(g , mrkn )}1nM : Watershed segmentations

{Pr (x, n)}1nM : Weighted contours (Bhattacharyya distance)

26 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

Bhattacharyya distance

Color image f (x) Color gradient g (x)

Density of contours pdf (x) Segmented with h = 0.02

27 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

1
Distance of means Bhattacharyya distance

Hellinger distance Wasserstein distance

1 F. Lpez-Mir, V. Naranjo, S. Morales, J. Angulo. Probability Density Function of


Object Contours Using Regional Regularized Stochastic Watershed. In IEEE ICIP'14. 28 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo estimation

2
Distance of means Bhattacharyya distance

Hellinger distance Wasserstein distance

2 F. Lpez-Mir, V. Naranjo, S. Morales, J. Angulo. Probability Density Function of


Object Contours Using Regional Regularized Stochastic Watershed. In IEEE ICIP'14. 29 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo Robust

estimation

Distance of means Bhattacharyya distance

Hellinger distance Wasserstein distance

30 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Probability density function MonteCarlo Robust

estimation

Distance of means Bhattacharyya distance

Hellinger distance Wasserstein distance

31 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Multivariate Gaussian Model of Regions in SW

Comparison with SRM

3
Statistical Region Merging (SRM) depending on scale parameter Q

Segmentation for Q = 128

Sum of contours from nine Q


256, 128, 64, 32, 16, 8, 4, 2, 1

Segmentation for Q = 32
3 R.
Nock, F. Nielsen. Statistical Region Merging. IEEE Trans. on PAMI,

26(11):14521458, 2004. 32 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Perspectives

1 Stochastic Watershed using MonteCarlo Simulations

2 Multivariate Gaussian Model of Regions in SW

3 Perspectives

33 / 34
Statistical Gaussian Model of Image Regions in Stochastic Watershed Segmentation
Perspectives

Perspectives

In addition to the color, each pixel x described also by its structure


tensor T (x) SPD(2):
Ri : N (0, i ), i = |Ri |1 xRi T (x)
P
Each region
Each region Ri : The histogram of structure tensors {T (x)}xRi
From to color to multi/hyper-spectral images: High-dimensional
covariance matrix estimated locally in regions

Supervised segmentation: Distance learning from training images of


annotated contours

MATLAB code available.

34 / 34

You might also like