Color Image Segmentation (TR)

  • Upload
    rjunji

  • View
    233

  • Download
    0

Embed Size (px)

Citation preview

  • 8/2/2019 Color Image Segmentation (TR)

    1/42

    Color image segmentation

    Giovanni Palma, Niels Van Vliet

    Technical Report no0404, June 2004revision 572

    This technical report presents several methods to segment color images. We focus on the clustering of images that have relevant colors.

    The rst section of this report explains several image processing tools. These tools, for example mor-phological opening or levellings, are useful for regularization purpose.

    Then a state of the art of morphological classiers is done. Five methods are explained. Their aim is toremove local extrema in the histogram, and at the same time to keep important clusters.

    Finally two new methods are presented, based on lters close to the volume levelling introduced by Vachier (2001).

    Ce rapport prsente des mthodes de segmentation dimages. Ici, nous allons seulement nous intresseraux problmes de segmentation o la couleur apporte une information pertinente.

    Dans une premire partie nous prsenterons diffrents outils qui permettent de rgulariser lespace

    des couleurs, comme les ouvertures morphologiques ou les ltres de nivellement. Ensuite nous passeronsrapidement sur diffrentes mthodes de classication de ce mme espace. Enn nous prsenterons unemthode base sur un ltre proche du nivellement de volume de Vachier (2001).

    KeywordsColor segmentation, Color, morphological classier, Levelling, Opening, Unsupervised classication

    Laboratoire de Recherche et Dveloppement de lEpita14-16, rue Voltaire F-94276 Le Kremlin-Bictre cedex France

    Tl. +33 1 53 14 59 47 Fax. +33 1 53 14 59 [email protected] http://www.lrde.epita.fr/

    http://[email protected]/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://[email protected]/
  • 8/2/2019 Color Image Segmentation (TR)

    2/42

    2

    Copying this documentCopyright c 2004 LRDE.

    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the FreeSoftware Foundation; with the InvariantSections being just Copying this document, no Front-Cover Texts, and no Back-Cover Texts.

    A copy of the license is provided in the le COPYING.DOC.

    http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/http://www.lrde.epita.fr/
  • 8/2/2019 Color Image Segmentation (TR)

    3/42

    Contents

    1 Tools used for segmentation 61.1 Gaussian Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

    1.1.1 Convolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61.1.2 Probability density function . . . . . . . . . . . . . . . . . . . . . . . . . . . 7

    1.2 Morphological tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.2.1 Structuring element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81.2.2 Erosion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.2.3 Dilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.2.4 Opening and Closing of gray tone images . . . . . . . . . . . . . . . . . . . 101.2.5 Area opening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11

    1.3 Levelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.3.1 Connected Filters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.3.2 Levelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.3.3 Volume levelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121.3.4 Integral levelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

    2 Image segmentation 152.1 From the image to the histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152.2 Operations on the histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

    2.2.1 Under-sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.2.2 Threshold . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.2.3 Gaussian . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.2.4 Opening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    2.3 State of the art . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.3.1 Postaire et al. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172.3.2 Zhang and Postaire . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.3.3 Park et al. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.3.4 Graud et al. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182.3.5 Graud et al. (second method) . . . . . . . . . . . . . . . . . . . . . . . . . 19

    2.4 Method using Integral lter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.4.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.4.2 Properties and drawbacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20

    2.5 Method using Volume lter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.5.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202.5.2 Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212.5.3 Meaning of the volume lter . . . . . . . . . . . . . . . . . . . . . . . . . . 212.5.4 Choice of parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21

    http://www.lrde.epita.fr/
  • 8/2/2019 Color Image Segmentation (TR)

    4/42

    CONTENTS 4

    2.5.5 Execution time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.6 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    2.6.1 House . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22

    2.6.2 Composition X . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.6.3 Rifain . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.6.4 E=M6 image sample . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.6.5 Evolution of the method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252.6.6 Results with others color spaces . . . . . . . . . . . . . . . . . . . . . . . . 27

    3 Implementation In Olena 29

    A Proofs 34A.1 Volume and integral levelling are not morphological lters . . . . . . . . . . . . . 34A.2 Volume and integral levelling based on external data are notmorphological open-

    ings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34A.3 Volume and integral levelling based on external data are algebraic openings . . . 34

    A.3.1 Anti-extensivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35A.3.2 Increasing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35A.3.3 Idempotent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36

    A.4 Two increasing attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36A.4.1 Interpretation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37

    A.5 Integral levelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37A.5.1 Integral levelling is a connected lter . . . . . . . . . . . . . . . . . . . . . 37A.5.2 Integral levelling is a levelling . . . . . . . . . . . . . . . . . . . . . . . . . 38

    B Bibliography 39

  • 8/2/2019 Color Image Segmentation (TR)

    5/42

    Introduction

    The color image segmentation is an operation which aims at nding coherent regions in a givencolor image. In this report, this problem and known methods based on morphological tools aregoing to be detailed. Those kinds of methods are used for several years. Other approaches exist,such as statistical method, or based on neural networks ones but they will not be presented here.

    This report focuses only on images in which each object has a relevant color. Thus the seg-mentation of color images based on other criteria, such as textures, is not discussed. In thisreport, the term object will be associated to a shape represented by a color that varies into asmall range of values in an image.

    Not all the methods presented here are based on mathematical morphology, but they are alllinked to this domain. Their goal is always to reduce the number of cluster in the color space toavoid the over-segmentation of the image. This segmentation is done in the color space. Firstthe histogram of the image is built. Then a lter is used to reduce the number of local maxima.Finally the watershed algorithm is used to create a partition of the color space. The differentvariations of this process will be described into details.

    First this report presents tools used for different segmentation methods. Then a state of theart of existing morphological methods is given. After that, two new methods are presented.These new segmentation methods are based on lters inspired of Volume levelling presented by

    Vachier (2001). Some results of these methods are discussed. Finally efcient implementationsof used lters and proof of their properties are given.

  • 8/2/2019 Color Image Segmentation (TR)

    6/42

    Chapter 1

    Tools used for segmentation

    In this chapter, tools used by different segmentation methods will be presented. First Gaussianlter will be dened, then some morphological tools will be detailed, and nally we will focuson different Levellings.

    1.1 Gaussian FilterApplying a Gaussian lter on a function is the same thing that convolving this one with aGaussian function. First the denition of the convolution will be presented, and in a secondpart the Gaussian function will be dened.

    1.1.1 ConvolutionThe convolution product is a linear operator widely used in signal processing. Its denition forcontinuous functions f is:

    f : P R , g : P R(f g)(x) = P f ( )g(x ) d(1.1)

    where P represents R n , n NIn image processing functions (images) used are not continuous. Thats why the previous

    formula ( 1.1) can not be directly used. Instead the discrete version of this formula is used, withP which represents Z n , n N :

    f : P R , g : P R(f g)(x) = i P f (i)g(x

    i) (1.2)

    Most of the time, one of the two functions is null over all its domain of denition except afew values in the center. This function is resumed to a kernel, called convolution kernel. Anexample of such a kernel is given in gure 1.1. The convolution will be performed by applyingthe equation 1.2. For example, like it can be seen in the gure 1.2, the result of a convolutionwill be the sum of the product of neighbors at a given point of two functions.

    Of course if the size of the kernel is big enough, this method of computation becomes heavy.In this case a property of the convolution product can be used. It can be proved that by convert-ing two functions into the frequency domain, the convolution can be computed by multiplying

  • 8/2/2019 Color Image Segmentation (TR)

    7/42

    7 Tools used for segmentation

    1 2 10 0 0-1 -2 -1

    Figure 1.1: The kernel of the Sobel gradient operator (edge detection).

    9 9 9 9 99 9 9 9 91 1 1 1 11 1 1 1 11 1 1 1 1

    *1 2 10 0 0-1 -2 -1

    9 1 + 9 2 + 9 1+ 0 1 + 0 1 + 0 1+ 1 1 + 1 2 + 1 1= 32Image to process Sobel kernel result on point (3;3)

    (high value means the point is on an edge)

    Figure 1.2: Example of convolution computation.

    the two functions point to point. This is not the subject in this report, so this point will not bedetailed here. If you are interested you can read the book of Nussbaumer (1982).

    1.1.2 Probability density functionThe Gaussian lter is based on the probability density function (p.d.f.) (1.3) used in statis-tic [ Jahne (2002)]. A p.d.f. veries:

    +

    f (x) dx = 1

    It is an important point, because convolving f with an image will not remove or add mass tothe image.

    The Gaussian p.d.f. f , for a given random vector g in D dimensions with mean and thecovariance matrix C is given by:

    f (x) =1

    (2)D/ 2det C e( g ) T C 1 ( g )

    2

    For uncorrelated random vectors, with equal variance 2 , and is the mean value, the Gaus-sian f is dened as:

    f (x) = 12 e12 ( x )

    2

    (1.3)

    To be able to use this function with an image in 2-D or even 3-D, it is needed to express thep.d.f. in its dimension:

    f (x, y) = 12 x y e12 ( x x x )2 + y y y

    2 (1.4)

    f (x,y,z ) = 1 x y z (2 )

    32

    e12 ( x x x )2 + y y y

    2+ ( z z z )

    2 (1.5)

  • 8/2/2019 Color Image Segmentation (TR)

    8/42

    1.2 Morphological tools 8

    In practice, standard deviations x , y and z will be equal. The mean values will be chosento correspond to the center of the kernel. Thus when computing the convolution at a givenpoint, the top of the Gaussian will be centered at this point (Fig. 1.3).

    Figure 1.3: Gaussian lter computation at a given point.

    1.2 Morphological toolsAnother set of lters used in image segmentation, and more generally in image processing is theset of morphological lters. First the erosion and dilation will be presented in order to denemorphological opening and closing in a second part. Finally the difference between algebraicopenings and morphological openings will be exposed.

    1.2.1 Structuring element

    A Structuring Element (SE) is a set used to probe an image. In this report, we will only use SEcomposed of points that have the same dimension as the image. These kinds of SE are called at SE. It exists non-at SEs that associate a value to points (Fig. 1.4). In the case of at SE, theset is a set of points. Non-at SEs consist of a set of points with a valuation associated to eachof them. For more details on non-at SE, see the book of Soille (1999).

    (a) Flat. (b) Non-at.

    Figure 1.4: Flat and non-at structuring elements.

    A Structuring Element has an origin. This origin is used to apply the structuring element at apoint of the image. If the origin is in the SE, the SE is centered (Fig. 1.5).

    The transposed of a SE B , is noted B t , and is the symmetry of the SE with respect to theorigin. The SE can be symmetric like it can been seen in gure 1.6, so B = B t .

  • 8/2/2019 Color Image Segmentation (TR)

    9/42

    9 Tools used for segmentation

    (a) Centered. (b) Not centered.Figure 1.5: Centered and not centered structuring elements.

    (a) Symmetric. (b) Not symmetric.

    Figure 1.6: Symmetric and not symmetric structuring elements with respect to the origin.

    1.2.2 ErosionIn the binary case, the denition of the erosion [ Soille (1999)] of a set X is:

    B (X ) = {x X/B x X }with B the structuring element used, and Bx this one centered at a point x.

    This means that a point is kept if the SE centered at this one is included in the object.Using the decomposition principle, this denition can be extended for gray scale images. The

    origin of a SE is placed at a point of the image. The output (Fig. 1.7) of the erosion by a at SEBv of a gray tone image f at a point x is dened as follow:

    [B v (f )](x) = minb B v {f (x + b)}

    (a) Structuringelement.

    (b) 2D Image withgray values (black

    = 0, white = 2).

    (c) SE centered at apoint of the image.

    (d) The eroded atthe chosen point is

    equal to 1.

    (d) Erosion of (b).

    Figure 1.7: Erosion of a gray scale image.

    1.2.3 DilationIn the binary case, the denition of the dilation [ Soille (1999)] of a set X by a SE B is:

  • 8/2/2019 Color Image Segmentation (TR)

    10/42

    1.2 Morphological tools 10

    B (X ) = {x/B x X = }with again B the structuring element used, and Bx this one placed at a point x.

    Like it has been done for the erosion, the decomposition principle allows to extend this de-nition in gray scale. The output at a point of the erosion is the minimum found in a set of pointsgiven by the SE. The dilation is the dual of this operator. Its output at a point is the maximumfound at the set of points dened by the SE (Fig. 1.8).

    (a) Original image (b) Dilation (a) Using the SE 1.7(a).

    Figure 1.8: Dilation

    The dilation of a set X can also be seen as the complement of erosion of the complement of

    X . The duality relation can be written as:

    B (X ) = B (X )

    where X is the complement of X .

    1.2.4 Opening and Closing of gray tone imagesThe erosion is useful to remove local maxima on a gray tone image. After an erosion edges areshift. A partial reconstruction of the image can be performed by a dilation with the same SEtransposed. Such a lter is called a morphological opening ( B , Fig. 1.9).

    B = B t B (1.6)with B the structuring element used.

    (a) Original image(black = 0, white = 2).

    (b) Erosion of (a) by a4-connected SE.

    (c) Dilation of (b), openingof (a).

    Figure 1.9: Opening of a gray scale image. The local maximum at the bottom right is removed.

    The closing B is the dual operator of the opening (Eq. 1.7, Fig. 1.10).

    B = B t BB (f ) = B (f )

    (1.7)

    An opening is called a morphological opening if it can be performed using an erosion and adilation. The morphological openings are a subset of the algebraic openings. Algebraic open-ings (Eq. 1.12) are morphological lters (Eq. 1.11) that are anti-extensive (Eq. 1.10).

  • 8/2/2019 Color Image Segmentation (TR)

    11/42

    11 Tools used for segmentation

    (a)Original image (black = 0,

    white = 2).

    (b)Dilation of (a) by a

    4-connected SE.

    (c)Erosion of (b), closing of

    (a).

    Figure 1.10: Closing of a gray scale image. The local minimum in the center is removed.

    F idempotent F F = F (1.8)F increasing

    (f, g ) f

    g F (f )

    F (g) (1.9)

    F anti-extensive f : P K, p P F (f )( p) f ( p) (1.10)F morphological lter F idempotent F increasing (1.11)

    F algebraic opening F idempotent F increasing Anti-extensive (1.12)

    1.2.5 Area openingAn example of algebraic opening is the area opening. This lter removes connected componentssmaller than a given area. Area opening of a gray tone image f at a point p is the maximumof the opening of f at p for all at SEs which have points (Fig. 1.11).

    (a) Original image. (b) Area opening.

    Figure 1.11: Area opening, with = 3 .

    1.3 Levelling

    In this section the work of Vachier (2001) will be explained. In order to introduce the volumelevelling, levellings are presented. As we will see, these lters are relevant in order to kill max-ima in the histogram. But rst, we will present the connected lters, which preserve contours.

    1.3.1 Connected FiltersConnected lters do not create new contours: if a at zone in the original image is sliced intoa non-at zone, the lter is not a connected lter. A lter is connected if and only if the at

  • 8/2/2019 Color Image Segmentation (TR)

    12/42

    1.3 Levelling 12

    zone C p connected to any point p in the original image, is included in the at zone connected tothe point in the output :

    f : P

    K, p P,

    C p(f ) C p((f )) (1.13)

    where is the lter, p a point in the domain P of the image f . The values of f are in K .An example of connected lter is presented in gure 1.12. By merging at zones, connected

    lters remove local maxima or minima. But it can be seen in this example that even if edgesare preserved, minima can become maxima and maxima can become maxima. Thus connectedlters can produce new local maxima.

    (a) f . (b) (f ).

    Figure 1.12: Connected lters do not create new transitions. Flat zones are not sliced.

    1.3.2 LevellingLevellings are connected lters that preserve the direction of the local transitions. Thus a localminima can be transformed into a local maxima. These lters can only remove extrema, but cannot create new ones. A lter is a levelling if and only if it is a connected lter, and if at anypoint p of any image f , the following property is true:

    neighborhood of p = N ( p)

    ( p, x) x N ( p),f ( p) f (x) (f )( p) (f )(x) (1.14)The levellings can remove some local extrema by merging the at zones of a local minima or

    maxima. They can not create new maxima.

    (a) f . (b) (f ).

    Figure 1.13: Levellings do not create new transitions and keep their directions.

    1.3.3 Volume levellingThe two lters we use are levellings. The rst one is the volume levelling. This lter has beenintroduced by Vachier (2001). As it can be seen in the gure 1.14, it removes maxima whichhave a volume smaller than a given threshold ( ).

    Let us introduce the following functions: the function returns the greatest connected com-ponent connected at a point p. The function S selects elements by performing a threshold on animage f , using a value t . The function V computes the volume of a set X using an image f :

  • 8/2/2019 Color Image Segmentation (TR)

    13/42

    13 Tools used for segmentation

    Figure 1.14: The volume levelling with = 6 of the function f (bold) is in gray.

    set X, p X X, (X, p ) = the connected set which contains p if p X otherwise

    f : P K, t K, S (f, t ) = { p P/f ( p) t}where P is the set of points of the image and K the set of values a pixel can take.set X, V (X, f ) =

    p X

    f ( p) |X | min p X f ( p)

    The volume levelling LV for any image f , at each point p, using a threshold is dened by:

    f : P K, p P,LV (f )( p) = maxtt K/t =0 V ( (S (f,t ) ,p ) ,f )

    This levelling is the base of the lter we use. The idea is to use this lter but rather than usingthe same function for the threshold and for the volume, two different functions are used. This

    lter can be dened as follow, on any images f and f (the values of the pixels can be in distinctsets, here K and K ), at any point p, with a threshold :

    f : P K, f : P K , p P,LV (f, f )(x) = maxtt K/V ( (S ( f,t ) ,p ) ,f )

    (1.15)

    The aim of this last lter is to be able to apply a lter close to the volume levelling afterother lters without using meaningless data resulting of the previous treatments. For exampleif a morphological closing is done on the image which removes local minima, the volume of an area of the image differs from the original image. This lter computes the volume of theoriginal image for a set of points. You can read the appendix to know what are the propertiesof this lter.

    1.3.4 Integral levellingWe have created another lter similar to the volume levelling, let us call it Integral levelling. Inthis lter, instead of removing maxima which have a given volume, the criterion is the integralof the function on a certain domain (Fig. 1.15).

    The denition of this lter L I on any image f at any point p is:

  • 8/2/2019 Color Image Segmentation (TR)

    14/42

    1.3 Levelling 14

    Figure 1.15: Integral levelling with = 11 .

    f : P K, p P,LI (f, p ) = maxtt K/k =0 Int ( (S ( f,t ) ,p ) ,f )

    where Int (X, f ) represents the integral of f on the domain X :f : P K, X P Int (X, f ) = p X f ( p)

    where again P is the set of points of the image and K the set of values a pixel can take.In the same way the lter 1.15 has been introduced, a new lter using integral levelling can

    be dened:

    f : P K, f : P K, p P,L I (f, f )(x) = maxtt K/k =0 Int ( (S ( f,t ) ,p ) ,f )

    (1.16)

    This variant of the integral levelling aims at providing better results in the case of applicationof many lters. You can again read the appendix to know what are the properties of this lter.

    In this chapter, many morphology-based tools and linear lters have been presented. The def-initions of theses lters which has been reminded here will be useful in the image segmentationprocesses presented in the next chapter.

  • 8/2/2019 Color Image Segmentation (TR)

    15/42

    Chapter 2

    Image segmentation

    This chapter will show how the previously introduced tools can be used to segment a colorimage. First the histogram and its utility will be presented. In a second part, some usefuloperations that can be performed on this one will be explained. Then a state of the art will presentexisting methods which use these operations. Finally two new methods based on integral andvolume lters will be presented.

    2.1 From the image to the histogramThe histogram of an image is an application which allows to count how many times a givenvalue is present in this one. For example, in the case of a histogram H associated to a RGBimage I , H ((1 , 0, 0)) corresponds to the number of red pixels present in I . Thus if there is a largezone which is yellow in the image, there will be a peak, more or less spread, in the associatedhistogram, hence the idea of catching these peaks to segment the image. The histogram can be considered as an image (3-D in the case of RGB color images) in order to use previouslyintroduced tools.

    Like it will be shown, most of the time histograms are highly irregulars. The goal of thissection is to explain the lack of regularity of the histogram. For the sake of simplicity the expla-nation is done for gray scale images.

    Let us start with an original image composed of homogeneous objects 1. Each peak in thehistogram corresponds to one object, is located at one point, and is surrounded by zero values(Fig. 2.1-a).

    But objects are not homogeneous. Peaks are spread in the histogram (Fig. 2.1- b). This leadsto two problems. First (Fig. 2.1-c), two heterogeneous objects that have almost the same colormay be overlapped. It means that one color corresponds to more than one object, and that theobjects can not be separated using a partition of the color space. The second problem appears inFig. 2.1-d, in which the two peaks are merged. Therefore the detection of the number of objectsis difcult. If objects do not have a common border line in the original 2-D image, the problem issolved easily. Two not connected objects which have the same label can be detected by ndingthe connected components in the original image. If not, the segmentation has to be done withmore information than the histogram.

    Objects are heterogeneous because of the noise, and the variation of color. Furthermore mostobjects are shadowed, or have transitions of colors. If there is no variation, it leads to a large

    1The term of object corresponds to a shape in the original image with a given color that may slightly vary.

  • 8/2/2019 Color Image Segmentation (TR)

    16/42

    2.2 Operations on the histogram 16

    a

    b

    c

    d

    e

    f

    g

    Figure 2.1: Image and histogram.

    maxima (Fig. 2.1-e). It is not really a problem. But if there is a variation within the object, there

    is more than one local maxima corresponding to only one object (Fig. 2.1-f, Fig. 2.1-g). In asense, this is not surprising, a high variation of color often corresponds to a border betweentwo objects. But this yield to an over-segmentation.

    The difcult point in the following methods is to avoid the over-segmentation due to thevariations within in the objects.

    2.2 Operations on the histogramSince histograms do not provide directly the results expected, we need to work on them. Thissection explains the link between an operation on the histogram, and the image.

    2.2.1 Under-samplingIf the original image is in the RGB color space, with each component coded on 8 bits, the his-togram registers 28

    3= 256 3 = 1677216 number of occurrences. This is time and memory con-

    suming because of such a precision 2. Thus it is preferable to speed up the process, to workon an under-sampled histogram (e.g. 25

    3= 32768 ). The under-sampling of the histogram is

    equivalent to a sub-quantication of the original image.28 bits per component is really precise, and in practice, this value can be decreased.

  • 8/2/2019 Color Image Segmentation (TR)

    17/42

    17 Image segmentation

    2.2.2 ThresholdA threshold of the histogram corresponds to ignore the colors that appear rarely in the originalimage. This might remove local maxima due to the noise, and objects with a variation of colorthat corresponds to low (and wide) peaks in the histogram. The threshold removes these max-ima. That can be considered as an error because in this last case, when the peak is wide enough,it is probably an object.

    2.2.3 GaussianIf the sampling of the histogram is too high, values are spread, and are not connected. This isthe case when the original image is small and/or the sampling of the histogram is high. In thiscase a convolution with a Gaussian can be used since this lter regularizes the data.

    At the same time a Gaussian lter on the histogram removes some local maxima and localminima, but also break more or less (depending on the standard deviation chosen) the structure.

    2.2.4 OpeningSpherical and card opening

    The histogram can be open using a morphological closing with a spherical structuring elementor with a card opening 3. It removes the tops of peaks that t in a sphere, or that correspond toa given volume.

    If objects are homogeneous, even a large object corresponds to a thin peak in the histogram.Such openings are likely to remove them. This might be avoided the usage of a Gaussian lterthat spread the peak.

    Integral levelling

    The integral leveling keeps peaks in the original image that have a at zone that corresponds tomore than pixels in the original image. The drawback is that these pixels might correspond tomore than one object in the original image.

    2.3 State of the art

    2.3.1 Postaire et al.Postaire et al. (1993) propose a classier based on binary morphological operators. In fact, theirclassier works on raw data to extract classes. This means that they are not talking about imagesegmentation, but data classication.

    The method consists in computing the histogram of the original image. After that, a thresholdis performed to be able to apply binary morphological operators. A binary opening is used. Theresulting image contains connected zones that are used to identify the clusters.

    This method has several drawbacks. One of them is that it is really hard to tune the parame-ters (threshold value, structuring element, etc.).

    3A card opening in 2D is an area opening.

  • 8/2/2019 Color Image Segmentation (TR)

    18/42

    2.3 State of the art 18

    2.3.2 Zhang and PostaireZhang and Postaire (1994) propose an evolution of the former method. The principle is toprocess the histogram with a lter which is convexity dependent. At each point, if this one isconvex, an erosion is performed, a dilation otherwise.

    To know the local convexity at a point p, the idea is to compare its density with the density of its neighborhood N ( p), in the histogram:

    Convex: H ( p) > Px N ( p )

    H (x )

    |N ( p) |

    Concave: H ( p) Px N ( p )

    H (x )

    |N ( p) |The main advantage of this method is to take into account the values of the histogram to

    simplify this one on a given point. This was not the case in the former method. Nonetheless,the resulting histogram is still too irregular to have a good segmentation.

    2.3.3 Park et al.Park et al. (1998) propose to calculate the difference of two Gaussian from the histogram. Thegure 2.2 presents the way the method works. First the histogram H 0 is computed 4. The convo-lution of H 0 with a Gaussian is computed, and the result corresponds to the histogram withoutneither the noise nor the peaks ( H 2). A second convolution with a Gaussian is performed on H 0 , but with a smaller standard deviation, this should give H 1 , the histogram H 0 without the noise.The subtraction of H 1 and H 2 gives the object peaks. A threshold is then applied to identify thekernels of the clusters. It is possible to assign color by looking for the nearest cluster in the colorspace.

    This method works well but is hard to tune because Gaussian parameters may vary depend-ing on the image to segment, and there is no method to compute them.

    2.3.4 Graud et al.Graud et al. (2001) use mathematical morphology for regularization purpose, and use the wa-tershed algorithm to create a partition of the 3-D space.

    The method can be detailed as follow:

    Step 1. Computation of the Histogram H (like other methods). Step 2. A logarithm is applied on H to enhance weight of small classes compared togreater ones. The inversion of the result is computed, let us call it H 1 . Step 3. A Gaussian lter is applied on H 1 to spread high peaks giving as result H 2 .

    Step 4. A closing using a disk as structuring element is then applied on H 2 to removemaxima.

    Step 5. Finally a connected watershed algorithm is used to cluster the color space usingnot killed minima.The main problem in this method is the difculty to tune the method to remove only un-

    wanted peaks. It depends on the choice of the standard deviation used in the Gaussian lter,and the size of the disk used in the closing.

    4To simplify the explanations, the histogram is in 1-D instead of 3-D

  • 8/2/2019 Color Image Segmentation (TR)

    19/42

    19 Image segmentation

    H 0

    Original HistogramH 2 , 2 = 1 .5

    Image - (peaks + noise)H 1 , 1 = 0 .5

    Image - noise

    Red = S (H 1 H 2)

    Figure 2.2: Park method on a 1-D histogram

    2.3.5 Graud et al. (second method)Clustering a 3-D histogram is time and memory expensive. This approach Xue et al. (2003)project the 3-D color space into 2-D color space. The three 2-D images are segmented using aGaussian, an inversion, a morphological closing and a watershed. Then a fusion of the differentsegmentation is performed; to produce a segmentation of the 3-D color space. This fusion isdone using region splitting and region merging.

    The results are close to the rst method, but it less time consuming (63.16s vs 6.53s for Kandin-skys Composition XFig. 2.7). In the methods proposed in this report, the computation is speedup using a sub-sampling version of the histogram.

    2.4 Method using Integral lterIn this section, the rst method we propose will be presented. This one is based on the Integrallter presented in the former chapter. First we are going to explain the global scheme used.Then we will interpret this lter, and show its drawbacks.

    2.4.1 Description

    Step 1. First a sub-quantication (n bits instead of 8 bits per components) is performedon the original color image. This step reduces the size of data and thus our color spacewill be under-sampled. Dividing by four the quantication divides by 64 the size of thehistogram. The main consequence is the increase of speed.

    Step 2. The 3-D histogram H of the image is computed. In order to enhance small valuesin the histogram compared to greater ones, a logarithm is applied giving H .

  • 8/2/2019 Color Image Segmentation (TR)

    20/42

    2.5 Method using Volume lter 20

    Step 3. In order to regularize the data, a 3-D Gaussian lter is applied on the histogramH . This lter is also used to remove some local extrema that may not be removed by theIntegral lter. The result is a 3-D image named H 1 .

    Step 4. In order to kill undesirable maxima (too small ones), an Integral lter (c.f. 1.16)is applied on H 1 using H data. Such a lter removes classes in the histogram that haveexactly less than pixel in the original image. Lets call the result H 2 .

    Step 6. In order to segment the previous result H 2 into different regions, a connectedwatershed algorithm is applied on the image resulting of the inversion of H 2 .

    2.4.2 Properties and drawbacksA good point of this method is the precision of the Integral lter. The usage of this one givesthe possibility to tell you want all classes that have more than pixels.

    Despite this good property, this lter is far from being perfect. In fact it works very well when

    objects are really dispersed in the histogram, but it is rarely the case. Sometimes, two or moreobjects are overlapped in the histogram. If there is a small one that has less than pixels inthe original image, it will not be removed due to the overlapping. The gure 2.3 shows such aproblem on an histogram in 1-D. That is why the Gaussian lter aims not only at regularizingdata, but also at removing some extrema, and then can be difcult to tune.

    Figure 2.3: Example of two overlapped objects in the histogram

    2.5 Method using Volume lterThe second new method we propose, aims at xing the problems that can be seen in the previ-ous one. The process we propose is simpler and gives better results. First the method will be

    described, and then, an interpretation will be given to explain why this method is better.

    2.5.1 Description

    Step 1. Like in the previous method, a sub-quantication of the original color image is per-formed. The goal is the same, and this allows again to increase the speed of the method. Step 2. The 3-D histogram H of the image is computed.

  • 8/2/2019 Color Image Segmentation (TR)

    21/42

    21 Image segmentation

    Step 3. In order to regularize the data, a 3-D Gaussian lter is applied on the histogram.Another consequence of this lter is to remove some local extrema, but it is not its goal.This step can be skipped if the original image is big enough compared to its quantization.

    In other words, the value of the standard deviation has to be small and can be deducedform the properties of the image. The result is a 3-D image named H 1 .

    Step 4. In order to kill undesirable maxima (too small ones), a volume lter is appliedon H 1 using H data. It makes sense to do such a thing since we want to remove smallamount of pixel in the original image, which correspond to remove peaks with less than pixels. Lets call the result H 2 .

    Step 5. Another important point is to remove small minima. To do that, the inversion of H 2 is computed, which transform local minima into local maxima. Thus another volumelevelling can be applied using data of H histogram inversion in order to remove those lastkind of extrema. A new histogram H 3 is then obtained.

    Step 6. In order to segment the previous result H 3 into different regions, a connectedwatershed algorithm is applied on H 3 .

    2.5.2 InterpretationThe usage of the Volume lter aims at improving the integral lter method. Itworks on the sameprinciple, small objects or variations have to be removed, and to do that counting the numberof occurrences is a good idea. Now, the problem of the overlapping is no more present: onlythe volume of what will be removed is considered. The log step is no more present, since it isno more needed to enhance small values compared to high ones (we only need to know whereare the maxima). Furthermore, the parameter of the Gaussian lter becomes easy to tune, andsometimes this last step can be omitted.

    The property of knowing exactly when a class will be removed is no-more present, since only

    the top of maxima are counted.

    2.5.3 Meaning of the volume lterIn the original image the color of an object is often far from being optimal. Most of the timesmall variations of color can be seen (because of the non uniformity of the object), this impliesthe existence of some small extrema (minima or maxima) in the histogram.

    With a small enough, the previously presented usage of our lter removes those kinds of extrema.

    2.5.4 Choice of parametersLike it can be seen, the two lters need parameters: the Gaussian and the volume lter.

    The rst one is more or less important since regularization of data is only useful when thehistogram is mostly empty. The consequence is that when the original image is big enough, theGaussian is useless. If it is not the case, only small value are needed because if the Gaussian istoo important original data may be altered.

    The second one is really more important than the rst one. In fact the modeling of whatis called small variations is directly linked to this parameter. If is too important, smallvariations and small objects are removed, and on the contrary if it is not big enough, not all

  • 8/2/2019 Color Image Segmentation (TR)

    22/42

    2.6 Results 22

    small variations are removed. The important thing is that practically the range where is validis big enough not to make the tuning of this parameter too hard.

    It can be seen in the next chapter, for a sigma very small, could vary widely giving each

    time a result similar.

    2.5.5 Execution timeLike it was the case for the method based on integral lter, this one is very fast. This is due tothe rst step: sub-quantication of the original image implies under-sampling of the histogramwhich results in less data to work with.

    2.6 ResultsThis section presents results using our method based on volume levelling, and sometimes acomparison with other ones.

    The difculty varies depending on the image to segment, and more precisely on the his-togram of this one. As a matter of fact, the more the classes are far from each other in thehistogram, the easier the segmentation is.

    2.6.1 HouseThe house image (Fig. 2.4) is a quite simple image to segment, because the colors in the his-togram (Fig. 2.5) are very far from each other.

    Figure 2.4: House original image.

    The segmentations obtained by our methods in the gure 2.6 are almost the same for allmethods presented in the state of the art.

    2.6.2 Composition XThe Kandinskys painting named Composition X(Fig. 2.7) is more difcult to segment.

    Like it can be seen in Fig. 2.8, the segmentation of the painting is quite similar to the originalpainting even if the number of color has been decreased (11 in the resulting image and 221349in the original).

  • 8/2/2019 Color Image Segmentation (TR)

    23/42

    23 Image segmentation

    Figure 2.5: Histogram slice of the house image (Fig. 2.4).

    Figure 2.6: House segmented image using volume lter (no Gaussian, = 0 .05%, sub-quantication = 5).

    Figure 2.7: Kandinskys Composition X.

  • 8/2/2019 Color Image Segmentation (TR)

    24/42

    2.6 Results 24

    Figure 2.8: Kandinskys Composition X segmentation using volume lter method.

    2.6.3 Rifain

    Figure 2.9: Matisses Rifain.

    The Matisses Rifain painting (Fig. 2.9) is a good example of hard segmentation because of the non-regularity of the histogram. In fact the result expected is really simple: the red oor, thelegs, the green clothes, the yellow, green and blue walls. Even if it seems quite simple, whenlooking at those colors, a lot of variations can be seen. Thus the corresponding histogram willhave a lot of extrema which will be more or less difcult to remove.

    Like it can be seen in Fig. 2.10, our method with the usage of the volume lter removes

    perfectly the small variations of colors. Thus unied colors are obtained.Another good point is the generalization of the dark green. In fact like it can be seen on theoriginal image, this color goes from a dark green to a very more dark one. Thus in the histograma large amount of green with a lot of variation is present: it is the real difculty of the image.Furthermore no usage of Gaussian lter has been needed to get such a result.

    Some other methods give more or less the same quality of result presented in Fig. 2.11. Theother ones give poor results. In this gure, it can be seen that the dark green cluster is separatedinto two other ones. Tuning parameters is useless because other cluster (legs and oor) can beeasily merged by giving too high parameters to the methods.

  • 8/2/2019 Color Image Segmentation (TR)

    25/42

    25 Image segmentation

    Figure 2.10: Matisses Rifain segmentation using volume lter method.

    Figure 2.11: Matisses Rifain segmentation using the Graud et al.s rst method.

    2.6.4 E=M6 image sampleImages that will be discussed here are used in concrete case. For example: the image 2.12 is usedfor automatic orientation of a robot. In this kind of image, the process has to be fast becausemany segmentations have to be performed. This is why the usage of the sub-quantication ishere very useful.

    A problem with those kind of data is the size of the original image: this one is small and thusgive an almost empty histogram. This implies the usage of a Gaussian lter to regularize thedata. This was not the case in the previous example.

    The result obtained is presented in the Fig. 2.13 and is, like it can be seen quite satisfying.

    2.6.5 Evolution of the methodIt can be interesting to see how the results vary depending on the evolution of the parameters.Two examples are presented: results obtained from the Matisses painting (Fig. 2.9) and theE=M6 example (Fig. 2.12). To have an idea of how evolves the volume levelling method, theprocess have been launched with parameters taken form a wide range of possible values. The

  • 8/2/2019 Color Image Segmentation (TR)

    26/42

    2.6 Results 26

    Figure 2.12: E=M6 test image.

    Figure 2.13: E=M6 test image result using the volume lter method.

    results of this tests on the gure 2.9 (resp. 2.12) are presented in gure 2.14 (resp. 2.15).

    Figure 2.14: Evolution of our method (volume lter in 5 bits) on the Matisses Rifain.

  • 8/2/2019 Color Image Segmentation (TR)

    27/42

    27 Image segmentation

    Like it can be seen on Fig. 2.14, the zone were the result is acceptable (in blue) is not narrow.In fact with an error of one or two classes 5, the result is similar when varies from 0.2 to 0.6.Furthermore the Gaussian is useless here and does not changes the result for tiny values of

    sigma. Nonetheless when sigma is too big, the data in the histogram are destroyed, and theresults are no more pertinent.

    Figure 2.15: Evolution of our method (volume lter in 5 bits) on E=M6 example.

    The case of the E=M6 image sample is different. Here the Gaussian is needed to have goodresults, but the comments on are, like it can be seen on blue regions in Fig. 2.15, always true.

    2.6.6 Results with others color spacesAll the previous tests has been performed using the RGB color space. It is well known that

    this space is not the best one to have a good representation of what a human can see. That iswhy tests have been made with other color spaces such as HSI , HSL, HSV , NRGB, XYZ, YIQ,YUV (Sangwine and Horne (1998)).

    Linear conversions like NRGB, XYZ do not give really better results because they do notchange the space topology. Thus the overlapping of classes that are different is preserved.

    Non-linear ones ( HSI , HSL, HSV ) are more interesting because they can give really differentresults and they can segment more efciently two classes that are close in the RGB color space.

    In those three last color spaces, results obtained on the E=M6 image 2.12 are more or lesssimilar to the Fig. 2.16. It can be seen that the green at the bottom on the right and on the leftis seen as the same color as the other green. This last point is interesting because it wasnt thecase in RGB, although an human eye would have merged these regions.

    5The error corresponds here to number of wanted classes compared to the number of actually found.

  • 8/2/2019 Color Image Segmentation (TR)

    28/42

  • 8/2/2019 Color Image Segmentation (TR)

    29/42

    Chapter 3

    Implementation In Olena

    The implementation of Volume and Integral lters (1.16, 1.15) in Olena is based on a variantof the Tarjans union-nd algorithm presented in Meijster and Wilkinson (2002) and Wilkinsonand Roerdink (2000).

    Name Type Meaningparent vector Give the parent of a pointaux_data vector Give attribute value of a componentcomp_value vector Give value (gray level) of a componentncomps integer Current number of componentinput image Image to processto_comp image Image that associates a component number to a pointenv environment Environment that contains data to compute the attribute value

    Figure 3.1: Variables used in Tarjans union-nd algorithm.

    The union-nd algorithm works on levels of the image to process. The aim is to removemaxima of an image, to do that the processing order will be determined by the value of theimage: point corresponding to high value will be processed rst.

    The core of the algorithm can be described as follow:

    Sort the points of the image in decreasing image value order For each point:

    Make a new set containing the point (gure 3.2)

    For each neighbor which the volume of the component is less thanlambda

    , mergethe two components

    Labelling each point by the value of its componentThe make set procedure (gure 3.2) creates a new component containing only one point. It

    also computes its attribute value and the component value using data included in env. It is anew way to compute attributes allowing the usage of our Volume lter.

    The nd root function will nd the component associated to another component. It will alsomake a compression to make root nding faster if the function is called more than one time on

  • 8/2/2019 Color Image Segmentation (TR)

    30/42

    30

    make_set(const point_type& x){

    to_comp[x] = ncomps + 1;

    parent.push_back(ncomps + 1);aux_data.push_back(ATTRIBUTE(input, x, env));comp_value.push_back(input[x]);

    }

    Figure 3.2: The make set procedure.

    comp_typefind_root(const comp_type& x){

    if (parent[x] is different from x)return parent[x] = find_root(parent[x]);return x;

    }

    Figure 3.3: The nd root function.

    the same component. To do that the parent of a component will be directly linked to its root.Two components are associated if they belongs to the same set.

    boolcriterion(const comp_type& x, const point_type& y){

    return ((comp_value[x] == input[y]) or (aux_data[x] < lambda));}

    Figure 3.4: The criterion test.

    The criterion test (gure 3.4) tells whether two components can be merged. It is the case whenthey are on the same level (connected component) or when the attribute value of the rst isinferior to .

    The union procedure is important since it tries to merge two components without making

    usage of too much memory to store the attribute value. The sets created by make set that havenot been merged yet, are merged directly to other component. Thus there is no need to keep thevalue of the attribute of the component that have been merge (only one point was referring toit).

    The is_proc test (gure 3.6) is another memory optimization with no cost in execution timeterm. The idea is assign the component number of a point to an invalid value. In practice theinnite value is of course not used, instead the maximum value of data type we are working onis a good candidate.

    The algorithm presented in Meijster and Wilkinson (2002) uses an image to stock the attribute

  • 8/2/2019 Color Image Segmentation (TR)

    31/42

    31 Implementation In Olena

    voiduni(const point_type& n, const point_type& p){

    comp_type r = find_root(to_comp[n]);

    if (r is different from to_comp[p]) // check if we are// on a new component.

    if (criterion(r, p)){

    if (to_comp[p] == (ncomps + 1)) // first merge of p component{

    comp_value[r] = input[p];aux_data[to_comp[p]] += aux_data[r];aux_data[r] = aux_data[to_comp[p]];to_comp[p] = r;

    }

    else{

    aux_data[find_root(parent[to_comp[p]])] += aux_data[r];parent[r] = parent[to_comp[p]];

    }}else{

    // set p component to inactiveaux_data[parent[to_comp[p]]] = lambda;

    }}

    Figure 3.5: The union procedure.

    bool is_proc(const point_type &p) const{

    return to_comp[p] is different from infinite;};

    Figure 3.6: Test to tell if a point has already been proceeded.

    value for every point. This is fast but has the default of being greedy in memory usage. On thecontrary, in Wilkinson and Roerdink (2000), the memory usage is reduced to the minimum sincethere is only one attribute by component. The problem is that the management memory slowsdown the last method. Our algorithm gives a good compromise between the two approaches.

  • 8/2/2019 Color Image Segmentation (TR)

    32/42

    32

    tarjan(const lambda_type & lambda,const abstract::neighborhood& Ng)

    {vector of point I;

    sort(I)

    // We are ready to perform stufffor each point p of I

    {point_type p_p = I[p];make_set(p_p);for each neighbor of p_p

    if (is_proc(Q_prime))uni(Q_prime.cur(), p_p);

    }

    // Resolving phaseimage_type output(input_.size());for each point p of I

    output[p] = comp_value[find_root(to_comp[p])]return output;

    }

    Figure 3.7: The main function of the attribute union-nd algorithm.

  • 8/2/2019 Color Image Segmentation (TR)

    33/42

    Conclusion

    Several image segmentations methods have been presented in this report. In order to do that,the tools used in these ones have been reminded.

    Furthermore, two new fast methods have been proposed. They are based on lters inspiredform the Volume Levelling presented by Vachier (2001). These methods give good results onthe tested images, and are fast to compute, compared to the other methods, due to the sub-quantization of the input image. Those approaches are well adapted for real time applicationssuch as image segmentation for robots.

    Further work can be done in order to improve these segmentation methods. The prior lo-cal knowledge might be used with a Markov random eld to get a good segmentation. Priorknowledge can be added directly in the process using a modied histogram. The data addedin the modied histogram might be weighted using the homogeneity within a neighborhood inthe original image. Finally, it has been shown that the color space has an impact on the result.It would be interesting to work on this problem.

    Finally, the new methods have to be run on a larger data base of images. Thus, the propertiesand the stability of these methods would be better known.

  • 8/2/2019 Color Image Segmentation (TR)

    34/42

    Appendix A

    Proofs

    This appendix presents all the properties and the associated proofs of the variants of the vol-

    ume (Eq. 1.15) and integral (Eq. 1.16) levellings.

    A.1 Volume and integral levelling are not morphological ltersA lter is a morphological lter if it is idempotent ( A.3.3) and increasing A.3.2.

    Volume and integral levelling are not idempotent. Therefore they are not morphological lter.

    A.2 Volume and integral levelling based on external data arenot morphological openings

    The volume and integral opening are not based on one SE. Thus they are not morphologicalopenings.

    A.3 Volume and integral levelling based on external data arealgebraic openings

    Notations:

    P : a bounded set, K : a bounded set,

    f : an image,

    f : P K p f ( p) D : the external data,

    D : P R+ p D( p)

  • 8/2/2019 Color Image Segmentation (TR)

    35/42

    35 Proofs

    (e, p): Greatest sub-set of e connected to p.

    :(E, P ) E (e, p)

    if p e then greatest x e/p x and x connectedelse 0

    S: set of points higher or equal to a threshold,S (f, t ) { p P/f ( p) t}

    A : Attribute,A :

    E (True |False ) with E a set of elements of Pe A (e)Let us dene a lter L :

    L :(P K ) (K P )L (f )( p) = maxt

    t K/t = min (K ) A ( (S (f,t ) ,p ))

    First we are going to show that L is an algebraic opening if A veries formula A.3. In otherword, if the attribute is true for a set of points, it must be true if points are added to the set.

    e1 e2 (A(e1) A(e2))equivalent to:A(e) = e e A(e )

    Then we will show that an attribute that computes the volume of a peak and one that computesthe integral of a peak are increasing. Finally we will conclude.

    A.3.1 Anti-extensivityThe goal of this subsection is to show that L is anti-extensive.

    L anti-extensive L IdLet us assume that L > Id . We are going to prove that it is not possible.

    Let f (K P ), p P, t = L (f )( p)A ( (S (f, t ), p))p S (f, t )f ( p) tL (f )( p)

    f ( p)

    This is not possible. Thus L is anti-extensive.

    A.3.2 IncreasingThe goal of this subsection is to show that L is increasing if the attribute A veries A.3. Thelter L is increasing if :

    L increasing (f, g ) (K P )2 f g L (f ) L (g)

  • 8/2/2019 Color Image Segmentation (TR)

    36/42

    A.4 Two increasing attributes 36

    Let f, and g two images, f g, if for any point p, f ( p) g( p).Let (f, g ) (K P )2 /f g

    t S (f, t ) S (g, t)

    (S (f, t ), p) (S (g, t), p)And we assumed that A is increasing. Thus :

    (A ( (S (g, t), p)) A ( (S (f, t ), p)))

    p P max tt K/A ( (S ( f,t ) ,p )) maxtt K/A ( (S (g,t ) ,p ))L (f ) L (g)

    Thus L is increasing.

    A.3.3 IdempotentThe goal of this subsection is to show that L is idempotent:

    L idempotent L L = LFirst we will show that L L L then L L Lw. It is easy to prove that L L L, becausewe proved that L is anti-extensive.

    L anti-extensive L IdL L LNow we are going to prove that L L L. For a given image f , and a given point p, we showthat the level k of this point in L (f ), can not be smaller in L L (( f ):

    Let f (K P ), p P, k = L (f )( p), cc = (S (f, k ), p)A (cc) (denition of L)

    i cc (S (f, k ), i) = (S (f, k ), p)A ( (S (L (f ), k), i))Thus i cc, L (f )( i) k.

    i cc i S (L (f ), k)cc S (L (f )( i), k)A ( (L (f )( i), k))L L (f )( p) k

    Thus L L L .Knowing that L L L and L L L , we can conclude that L L = L . Thus L isidempotentIf A veries A.3, L is idempotent and increasing. Therefore it is a morphological lter. It is

    anti-extensive, thus it is an algebraic opening.

    A.4 Two increasing attributesTwo attributes are going to be dened that verify A.3.

  • 8/2/2019 Color Image Segmentation (TR)

    37/42

    37 Proofs

    The rst one is true if the integral on the set of connected point is greater than :

    AI =i= |e |

    i=1

    D (ei )

    D is positive, thus e f (AI (e) )AI (f ).If D corresponds to the values of f , it is close to a levelling of integral. It is not a levelling of

    volume, because it is idempotent.The second one is true if the volume of the peak is bigger than :

    AV =i e

    D (i) |e|mini e D(i) If D corresponds to the value of f , it is close to a levelling of volume.

    A.4.1 Interpretation

    Using AV and AI these lters are openings. Dual lters can be dened: Lc = L (f ). Noticethat event if f is the parameter, the function D must not be changed.

    We do not use the same image for the function D and the f . Our interpretation of D is aweight for each point. So we do not compute the volume of the peaks of f but the weight of thepeaks. The weight can be modied independently of the shape of f. D/F can be interpreted asa density.

    A.5 Integral levellingThis section is going to show that the integral levelling is a levelling.

    A.5.1 Integral levelling is a connected lter Connected lter f K P , (x, y ) P 2 , y N (x) f (x) = f (y) (f )(x) = (f )(y)

    let f : P K let (x, y) P 2 /y N (x) f (x) = f (y)let k = LV (f )(x)

    the denition of LV gives:k = maxt

    t K/A V ( (S ( f,t ) ,x ) ,f )

    f (x) = f (y) y N (x) (S (f, t ), x) = (S (f, t ), y)using the denition of LV we have:k = LV (f )(y)thusLV (f )(y) = LV (f )(x)

    LV is a connected lter

  • 8/2/2019 Color Image Segmentation (TR)

    38/42

    A.5 Integral levelling 38

    A.5.2 Integral levelling is a levelling levelling connected lter f K P , (x, y ) P 2 , y N (x) f (x) f (y) (f x ) (f y )

    let f : P K let (x, y ) P 2/y N (x) f (x) f (y)let k = LV (f )(x)the denition of LV gives:k = maxt

    t K/A V ( (S ( f,t ) ,x ))

    f (y) f (x)and x and y neighbor y (S (f, t ), x)thus (S (f, t ), x) (S (f, t ), y)and

    AV ( (S (f, t ), x) AV ( (S (f, t ), y)))L

    V (f )(x)

    L

    V (f )(y)

    LV levelling

  • 8/2/2019 Color Image Segmentation (TR)

    39/42

    Appendix B

    Bibliography

    Graud, T., Strub, P., and Darbon, J. (2001). Color image segmentation based on automatic mor-phological clustering. In IEEE International Conference on Image Processing, volume III, pages7073.

    Jahne, B. (2002). Digital Image Processing. Springer.

    Meijster, A. and Wilkinson, M. (2002). A comparison of algorithms for connected set openingsand closings. IEEE Transactions on Pattern Analysis and Machine Intelligence, 24(4):484494.

    Nussbaumer, H. (1982). Fast Fourier Transform and Convolution Algorithms. Springer, Berlin.

    Park, S., Yun, I., and Lee, S. (1998). Color image segmentation based on 3-d clustering: Mor-phological approach. Pattern Recognition, 31(8):10611076.

    Postaire, J., Zhang, R., and Lecocq-Botte, C. (1993). Cluster analysis by binary morphology.

    IEEE Transactions on Pattern Analysis and Machine Intelligence, 15(2):170180.Sangwine, S. J. and Horne, R. E. N., editors (1998). The Colour Image Processing Handbook.Optoelectronics Imaging and Sensing. Chapman and Hall, London.

    Soille, P. (1996). Morphological partitioning of multispectral images. Journal of Electronic Imag-ing, 5(3):252265.

    Soille, P. (1999). Morphological Image Analysis. Springer-Verlag, Berlin, Heidelberg , New York .

    Vachier, C. (2001). Morphological scale-space analysis and feature extraction. In IEEE Interna-tional Conference on Image Processing, volume III, pages 676679.

    Vincent, L. and Soille, P. (1991). Watersheds in digital spaces: An efcient algorithm based

    on immersion simulations.IEEE Transactions on Pattern Analysis and Machine Intelligence

    ,13(6):583598.

    Wilkinson, M. and Roerdink, J. (2000). Fast morphological attribute operations using tarjansunion-nd algorithm. In Mathematical Morphology and its Applications to Image and Signal Pro-cessing, Kluwer, pages 311320.

    Xue, H., Graud, T., and Duret-Lutz, A. (2003). Multi-band segmentation using morphologicalclustering and fusion: application to color image segmentation. In IEEE International Conferenceon Image Processing, volume I, pages 353356.

    http://ams.jrc.it//soille/book1sthttp://www.springer.de/cgi-bin/search_book.pl?isbn=3-540-65671-5http://www.springer.de/cgi-bin/search_book.pl?isbn=3-540-65671-5http://www.springer-ny.com/catalog/np/apr99np/3-540-65671-5.htmlhttp://www.springer-ny.com/catalog/np/apr99np/3-540-65671-5.htmlhttp://www.springer-ny.com/catalog/np/apr99np/3-540-65671-5.htmlhttp://www.springer.de/cgi-bin/search_book.pl?isbn=3-540-65671-5http://ams.jrc.it//soille/book1st
  • 8/2/2019 Color Image Segmentation (TR)

    40/42

    BIBLIOGRAPHY 40

    Zhang, R. and Postaire, J. (1994). Convexity dependent morphological transformations formode detection in cluster analysis. Pattern Recognition, 27(1):135148.

  • 8/2/2019 Color Image Segmentation (TR)

    41/42

    List of Figures

    1.1 The kernel of the Sobel gradient operator (edge detection). . . . . . . . . . . . . . 71.2 Example of convolution computation. . . . . . . . . . . . . . . . . . . . . . . . . . 71.3 Gaussian lter computation at a given point. . . . . . . . . . . . . . . . . . . . . . 81.4 Flat and non-at structuring elements. . . . . . . . . . . . . . . . . . . . . . . . . . 81.5 Centered and not centered structuring elements. . . . . . . . . . . . . . . . . . . . 91.6 Symmetric and not symmetric structuring elements with respect to the origin. . . 91.7 Erosion of a gray scale image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91.8 Dilation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101.9 Opening of a gray scale image. The local maximum at the bottom right is removed. 101.10 Closing of a gray scale image. The local minimum in the center is removed. . . . 111.11 Area opening, with = 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111.12 Connected lters do not create new transitions. Flat zones are not sliced. . . . . . 121.13 Levellings do not create new transitions and keep their directions. . . . . . . . . . 121.14 The volume levelling with = 6 of the function f (bold) is in gray. . . . . . . . . . 131.15 Integral levelling with = 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

    2.1 Image and histogram. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162.2 Park method on a 1-D histogram . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192.3 Example of two overlapped objects in the histogram . . . . . . . . . . . . . . . . . 202.4 House original image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222.5 Histogram slice of the house image (Fig. 2.4). . . . . . . . . . . . . . . . . . . . . . 232.6 House segmented image using volume lter (no Gaussian, = 0 .05%, sub-

    quantication = 5). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.7 Kandinskys Composition X. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232.8 Kandinskys Composition X segmentation using volume lter method. . . . . . . 242.9 Matisses Rifain. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242.10 Matisses Rifain segmentation using volume lter method. . . . . . . . . . . . . . 252.11 Matisses Rifain segmentation using the Graud et al.s rst method. . . . . . . . . 252.12 E=M6 test image. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 262.13 E=M6 test image result using the volume lter method. . . . . . . . . . . . . . . . 262.14 Evolution of our method (volume lter in 5 bits) on the Matisses Rifain. . . . . . 262.15 Evolution of our method (volume lter in 5 bits) on E=M6 example. . . . . . . . . 272.16 E=M6 test image result using the volume lter method in HSL color space. . . . . 28

    3.1 Variables used in Tarjans union-nd algorithm. . . . . . . . . . . . . . . . . . . . 293.2 The make set procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303.3 The nd root function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30

  • 8/2/2019 Color Image Segmentation (TR)

    42/42

    LIST OF FIGURES 42

    3.4 The criterion test. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303.5 The union procedure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313.6 Test to tell if a point has already been proceeded. . . . . . . . . . . . . . . . . . . . 31

    3.7 The main function of the attribute union-nd algorithm. . . . . . . . . . . . . . . 32