<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <title-group>
        <article-title>New HSL Distance Based Colour Clustering Algorithm</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>Vasile Patrascu</string-name>
          <email>patrascu.v@gmail.com</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>Departement of Informatics Technology, Tarom Company Calea Bucurestilor 224F</institution>
          ,
          <addr-line>Bucharest</addr-line>
          ,
          <country country="RO">Romania</country>
        </aff>
      </contrib-group>
      <abstract>
        <p>In this paper, we define a distance for the HSL colour system. Next, the proposed distance is used for a fuzzy colour clustering algorithm construction. The presented algorithm is related to the well-known fuzzy c-means algorithm. Finally, the clustering algorithm is used as colour reduction method. The obtained experimental results are presented to demonstrate the effectiveness of our approach.</p>
      </abstract>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>Introduction</title>
      <p>A colour image generally contains tens of thousands of
colours. Therefore, most colour image processing
applications first need to apply a colour reduction method
before performing further sophisticated analysis operations
such as segmentation. The using of colour clustering
algorithm could be a good alternative for colour reduction
method construction. In the framework of colour clustering
procedure, we are faced with two colour comparison subject.
We want to know how similar or how different two colours
are. In order to do this comparison, we need to have a good
coordinate system for colour representation and also, we
need to define an efficient inter-colour distance measure in
the considered system.</p>
      <p>
        In this paper we will consider the particular case of colour
representation by the perceptual system HSL (hue,
saturation and luminosity)
        <xref ref-type="bibr" rid="ref8">(Smith 1978)</xref>
        . The obtained
degree of similarity or dissimilarity is dependent on the used
inter-colour distance
        <xref ref-type="bibr" rid="ref2">(Carron 1995)</xref>
        ,
        <xref ref-type="bibr" rid="ref5">(Lim et al. 1990)</xref>
        ,
        <xref ref-type="bibr" rid="ref9">(Sarifuddin et al. 2005)</xref>
        ,
        <xref ref-type="bibr" rid="ref10">(Trivedi et al. 1986)</xref>
        . In the HSL
colour comparison procedure, the three colour components
have not the same importance. Thus, the most important is
the hue, the saturation is the next and finally, the luminosity
is less important. Because of this reason, we can define some
colour clustering methods that use the bi-dimensional space
HS . On this way, it is neglected the third component, the
luminosity. This method is very good for those images that
are quite saturated. In the same time, this method has the
disadvantage of supplying erroneous clusters for the less
saturated colours because it does not take into account the
achromatic component, the luminosity. On the other side,
when the luminosity is taken into account in the distance
formula, there are arising situations when two colours are
placed in different clusters because of the difference between
their luminosities despite of their strong similarity in the
chromatic space HS .
      </p>
      <p>In this paper, we propose a distance that minimizes the two
disadvantages mentioned above. This distance is constructed
as a quasi-linear combination of the three standard distances
of H, S, L scalar components. Next, this distance is used for
a fuzzy colour clustering construction.</p>
      <p>In the following sections, the paper is thus organized: section
2 presents the particular form of the system HSL used in this
paper; section 3 presents the new colour distance; section 4
presents the colour clustering algorithm based on the
proposed distance and related to the fuzzy c-means
algorithm; section 5 presents some experimental results
while section 6 outlines the conclusions.</p>
    </sec>
    <sec id="sec-2">
      <title>The Perceptual Colour System HSL</title>
      <p>
        The most part of the colour images are represented by the
RGB colour system. However, this space presents the
following two important limitations: the difficulty to
determine colour features like the presence or the absence of
a given colour, and the inability of the Euclidean distance to
correctly capture colour differences in the RGB space.
Starting from the RGB system, there were defined other
systems for colour representation. One of them is the HSL
system where H is the hue, S is the saturation and L is
the luminosity. Colour space HSL is also commonly used in
image processing. As opposed to RGB system, HSL is
considered as natural representation colour system. The
HSL system belongs to the perceptual system category
because it is very close to the human colour perception. In
the HSL system, colour is decomposed according to
physiological criteria like hue, saturation and luminosity.
Hue refers to the pure spectrum colours and corresponds to
dominant colour as perceived by human. Saturation
corresponds to the relative purity or the quantity of white
light that is mixed with hue while luminosity refers to the
amount of light in a colour (Gonzales et al. 2007). A great
advantage of HSLsystem over the RGB lies in its capacity
to recognize the presence of colours in a given image.
There exist many formulae for H, S, L components
calculation. For the hue H , the most part of the definitions
are closed to the following formula that uses the atan2
function
        <xref ref-type="bibr" rid="ref3">(ECMA-262 2011)</xref>
        :
      </p>
      <p> B  G 2R  B  G </p>
      <p>H  atan2 2 , 6 
and H  ( , ].</p>
      <p>
        For the luminosity calculation, in this paper, the following
formula will be used
        <xref ref-type="bibr" rid="ref7">(Patrascu 2012)</xref>
        :
      </p>
      <p>L </p>
      <p>M
1 M  m</p>
      <p>M  max(R, G, B)
where
and</p>
      <p>m  min(R,G, B) .</p>
      <p>
        Regarding to the saturation calculation, many variants are
defined by the distance between max(R, G, B) and
min(R, G,.B) . In this paper, we will use for saturation
calculation, the following formula
        <xref ref-type="bibr" rid="ref6">(Patrascu 2009)</xref>
        :
S 
      </p>
      <p>2(M  m)
1 | M  0.5 |  | m  0.5 |
We
suppose</p>
      <p>R,G, B [0,1]
and
it
results
that
M, m, S, L [0,1] .</p>
    </sec>
    <sec id="sec-3">
      <title>The New HSL Colour Distance</title>
      <p>In the Cartesian coordinate system (x, y, z)  R3 , for two
vectors v1  (x1, y1, z1) , v2  (x2 , y2 , z2 ) one defines the
Euclidean distance by:
DE2 (v1, v2 )  (x1  x2 ) 2  ( y1  y2 ) 2  (z1  z2 ) 2
In order to obtain the variant of Euclidean distance for the
cylindrical coordinate system, we use the following
substitution:
x   cos( ) , y   sin( ) , z  l .
(1)
(2)
(3)
d 2(1,2)  sin 21 2 </p>
      <p> 2 
The coordinate system HSL is a cylindrical one and for two
colours Q1  (H1, S1, L1) and Q2  (H2 , S2 , L2 ) , the
Euclidean distance becomes (Gonzales et al. 2007):
DE2 (Q1, Q2)  4S1S2  d 2(H1, H2)  d 2(S1, S2) 
 d 2(L1, L2)
The colour Euclidean distance DE has three terms: the
distance between hues, the distance between saturations and
the distance between luminosities. The distance between
hues is multiplied by a factor that depends on the colour
saturations. This factor has a multiplicative structure. Thus,
when the saturation values increase, the hues distance
influence increases in framework of distance DE . When the
saturation values decrease, the hue distance influence
decreases.</p>
      <p>From here, the idea to multiply the luminosity distance with
a similar factor comes up. This factor will have the following
behaviour: when the saturation values increase, the
luminosity distance influence decreases and when the
saturation values decrease, the luminosity distance influence
increases.</p>
      <p>We can generalize (4) using two real and positive
parameters  and  , by the following:
DP2 (Q1, Q2 )    d 2 (H1, H 2 )    d 2 (L1, L2 ) 
 d 2 (S1, S2 )
The parameter  will be related to the colour chromaticity
while the parameter  will be related to the colour
achromaticity. Before the construction of parameters  and
 , we define the index of chromaticity c and the index of
achromaticity a , having the following properties:
(4)
(5)
 index of chromaticity
c :[0,1]  [0,1],
(i) c(0)  0
(ii) c(1)  1
We will use for the chromaticity index the following
particular function:</p>
      <sec id="sec-3-1">
        <title>It results: were:</title>
        <p>DE2 (v1, v2 )  41 2  d 2 (1, 2 )  d 2 (1,  2 )  d 2 (l1, l2 )
if S1  S2 then c(S1)  c(S2 ) .</p>
        <p>c(S )  S
 index of achromaticity
a :[0,1] [0,1] ,
(i) a(0)  1 ,
(ii) a(1)  0 .
Using (6), (7), (8) and (9) for the two multipliers  and  ,
it results the following particular forms:</p>
      </sec>
      <sec id="sec-3-2">
        <title>The distance (5) becomes:</title>
        <p>DP2 (Q1, Q2 )  S1  S2 sin 2  H1  H 2  
 2 
 (1 S1 )  (1 S 2 )  (L1  L2 ) 2  (S1  S2 ) 2</p>
      </sec>
    </sec>
    <sec id="sec-4">
      <title>The Colour Clustering Algorithm</title>
      <p>
        Let there be n colours Q1, Q2 ,...,Qn that must be clustered
into k sets. Each cluster j is characterized by the
membership coefficients w j1, w j2 ,...,w jn for the considered
n colours and the cluster center defined by the colour
q j  h j , s j , l j . For colour clustering, we will construct an
algorithm that is similar to the fuzzy c-means algorithm
        <xref ref-type="bibr" rid="ref1">(Bezdek 1981)</xref>
        .
      </p>
      <p>The membership function wij is calculated using formula
(13), where the distance DP is calculated with formula (12).
i [1, n]

j [1, k]</p>
      <p>,
wij 
1</p>
      <p>2
k  DP Qi , q j   1
1  m1  DP Qi , qm  </p>
      <p>m j
The functions wij verify the condition of the partition of
wi1  wi2  ...  wik  1
The cluster center components h j , s j , l j  are calculated
with formulae (14), (15) and (16).</p>
      <p> n n 
  wij Ci  sin H i   wij Ci  cosH i  </p>
      <p>, i1
n
 wij Ci
i1
n
 wij Ci
i1




unity, namely:
i [1, n] ,
j [1, k] ,
h j  atan2 i1



with Ci  Si .
j [1, k] ,
with Ai  1  Si .
j [1, k] ,</p>
      <p>s j  i1
l j  i1
n
 wij Ai  Li
n
 wij Ai
i1
n
 wij  Si
n 
 wij
i1
(13)
(14)
(15)
(16)
where  is a fuzzification-defuzzification parameter and
also,   (1,1.5).</p>
    </sec>
    <sec id="sec-5">
      <title>Experimental Results</title>
      <p>We have applied this method to images: “red-green” (figure
1a), “flower” (figure 2a), “house” (figure 3a), “parrots”
(figure 4a) and “bird” (figure 5a). The clustered images
obtained using the new distance can be seen in figures 1b,
2b, 3b, 4b, 5b and those obtained using the Euclidean
distance can be seen in figures 1c, 2c, 3c, 4c, 5c.</p>
      <p>Figure 1a shows a synthetic image. Using the proposed
distance, it was obtain the 3-colour representation shown in
figure 1b while figure 1c shows the image obtained using the
Euclidean distance. In the first case, the black region has a
small area, while in the second case, it has a large one. This
fact proves the influence of achromatic parameter that was
used in the proposed distance.</p>
      <p>In the case of image “flower”, using the Euclidean distance it
was obtained two clusters for background. These two
clusters have the same hue but the luminosities are different
(figure 2c). Using the proposed distance, one obtained only
one cluster for the entire background (figure 2b).</p>
      <p>For image “house”, using the Euclidean distance, the white
and bright blue colours were not separated (figure 3c). In the
case of image “parrots”, the yellow and red colours were not
separated (figure 4c) and the clustering is different from that
obtained using the proposed distance (figure 4b). For the
image “bird”, using the Euclidean distance, the orange and
grey colours were not separated (figure 5c).</p>
      <p>The experimental results illustrate that our distance performs
well compared to Euclidean distance. In the same time, the
obtained results show the helpfulness of using this novel
inter-colour distance measure in colour clustering
algorithms.</p>
    </sec>
    <sec id="sec-6">
      <title>Conclusions</title>
      <p>In this paper one presents an enhancement of fuzzy c-means
algorithm for the particular case of colour clustering. It was
used the perceptual colour system HSL for colour
representation. The main step is represented by definition of
a new distance in the HSL colour space. In this construction,
there were used two multipliers that make the balance
between the hue weight and luminosity weight in the
framework of this three-term colour distance. We can
conclude that the new inter-colour distance “ DP ” defined by
(12), the two multipliers “ ” defined by (8) and “  ”
defined by (9), the particular form of index of chromaticity
“ c ” defined by (6) and achromaticity “ a ” defined by (7)
construct a new and useful framework for colour clustering
procedures. The obtained experimental results were
compared with those obtained by using the Euclidean
distance. This comparison shows the efficiency of the
proposed clustering algorithm using for the colour reduction
method.</p>
      <p>Figure 1: The image „red-green” (a) and its 3-colour
representation based on proposed HSL distance (b) and
based on HSL Euclidean distance (c).</p>
      <p>Figure 2: The image „flower” (a) and its 3-colour
representation based on proposed HSL distance (b) and
based on HSL Euclidean distance (c).</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          <string-name>
            <surname>Bezdek</surname>
            ,
            <given-names>J. C.</given-names>
          </string-name>
          <year>1981</year>
          .
          <article-title>Pattern Recognition with Fuzzy Objective Functions</article-title>
          , New York: Plenum Press.
        </mixed-citation>
      </ref>
      <ref id="ref2">
        <mixed-citation>
          <string-name>
            <surname>Carron</surname>
            ,
            <given-names>A. T.</given-names>
          </string-name>
          <year>1995</year>
          .
          <article-title>Segmentation d'images couleur dans la base Teinte Luminance Saturation: approche numérique et symbolique</article-title>
          ,
          <source>PhD Thesis</source>
          , Université de Savoie.
        </mixed-citation>
      </ref>
      <ref id="ref3">
        <mixed-citation>
          <source>ECMA-262</source>
          ,
          <year>2011</year>
          . ECMAScript® Language Specification, www.ecma-international.org/publications/standards/Ecma262.htm.
        </mixed-citation>
      </ref>
      <ref id="ref4">
        <mixed-citation>
          <string-name>
            <surname>Gonzalez</surname>
            ,
            <given-names>R. C.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Woods</surname>
            ,
            <given-names>R. E.</given-names>
          </string-name>
          <year>2007</year>
          .
          <article-title>Digital Image Processing</article-title>
          . Prentice Hall.
        </mixed-citation>
      </ref>
      <ref id="ref5">
        <mixed-citation>
          <string-name>
            <surname>Lim</surname>
            ,
            <given-names>Y. W. S.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Lee</surname>
            ,
            <given-names>U.</given-names>
          </string-name>
          <year>1990</year>
          .
          <article-title>On the colour image segmentation algorithm based on the thresholding and the fuzzy c-means techniques</article-title>
          ,
          <source>Pattern Recognition</source>
          , volume
          <volume>23</volume>
          , no.
          <issue>9</issue>
          ,
          <fpage>935</fpage>
          -
          <lpage>952</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref6">
        <mixed-citation>
          <string-name>
            <surname>Patrascu</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          <year>2009</year>
          .
          <article-title>New fuzzy color clustering algorithm based on hsl similarity</article-title>
          .
          <source>In Proceedings of the Joint 2009 International Fuzzy Systems Association World Congress (IFSA</source>
          <year>2009</year>
          ), Lisbon, Portugal.
        </mixed-citation>
      </ref>
      <ref id="ref7">
        <mixed-citation>
          <string-name>
            <surname>Patrascu</surname>
            ,
            <given-names>V.</given-names>
          </string-name>
          <year>2012</year>
          .
          <article-title>Fuzzy Membership Function Construction Based on Multi-Valued Evaluation, in vol. Uncertainty Modeling in Knowledge Engineering and Decision Making</article-title>
          ,
          <source>Proceedings of the 10th International FLINS Conference (FLINS</source>
          <year>2012</year>
          ), Istanbul, Turkey, World Scientific Press,
          <fpage>756</fpage>
          -
          <lpage>761</lpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref8">
        <mixed-citation>
          <string-name>
            <surname>Smith</surname>
            ,
            <given-names>A. R.</given-names>
          </string-name>
          <year>1978</year>
          .
          <article-title>Colour Gamut Transform Pairs</article-title>
          ,
          <source>Computer Graphics</source>
          <volume>12</volume>
          (
          <issue>2</issue>
          ).
        </mixed-citation>
      </ref>
      <ref id="ref9">
        <mixed-citation>
          <string-name>
            <surname>Sarifuddin</surname>
            ,
            <given-names>A. M.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Missaoui</surname>
            ,
            <given-names>R.</given-names>
          </string-name>
          <year>2005</year>
          .
          <article-title>A new perceptually uniform colour space with associated colour similarity measure for content based image and video retrieval</article-title>
          ,
          <source>In Proceedings of Multimedia Information Retrieval Workshop</source>
          , 3-
          <fpage>7</fpage>
          .
        </mixed-citation>
      </ref>
      <ref id="ref10">
        <mixed-citation>
          <string-name>
            <surname>Trivedi</surname>
            ,
            <given-names>A. M.</given-names>
          </string-name>
          ;
          <string-name>
            <surname>Bezdek</surname>
            ,
            <given-names>J. C.</given-names>
          </string-name>
          <year>1986</year>
          .
          <article-title>Low-level segmentation of aerial images with fuzzy clustering</article-title>
          ,
          <source>IEEE Trans. On Systems, Man, and Cybernetics</source>
          , volume.
          <volume>16</volume>
          , no.
          <issue>4</issue>
          ,
          <fpage>589</fpage>
          -
          <lpage>598</lpage>
          .
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>