4
Introducing a New Metric for Automatic True Color Images Granulometry A. Montenegro, E. P. Calixto, A. Conci and E. Clua Departamento de Ciência da Computação Universidade Federal Fluminense (UFF) Rua Passo da Pátria 156 - Bloco E - 3º andar São Domingos, Niterói - RJ - CEP: 24210-240 Phone +55 (21) 2629-5665/5666 E-mail: {anselmo, ecalixto, aconci, esteban}@ic.uff.br Keywords: metric spaces, granulometry, color mathematical morphology. Abstract – Mathematical morphology (MM) is a powerful tool for automatic extraction of grain-sized data from digital images. In many cases, color information can be quite useful for the enhancement of the results obtained. Nevertheless, the definition of color MM, as simple extension of gray level MM, does not work appropriately for granulometry applications. The problem is that fake colors arise in the results obtained by applying morphological granulometry separately for each color component in the recombination stage. In order to solve this problem it is necessary to define an ordering in an appropriate color space. This work proposes a new metric defined in the HSV color space. We named this chromaticity constant. The validity of this is shown by the experimental results obtained by the application of the metric to synthetic and real images. 1. INTRODUCTION The grain-size distribution or granulometries is one of most traditional mathematical morphology (MM) applications since the MM development in the 1960´s by G. Matheron [1930-2000] and J. Serra [1]. It is used to analyze the structures of elements and to identify these elements as well. Widely explored in bilevel and grey scale, the morphology of true color images presents aspects for deeper researches. Color and multi-channel MM in many cases can be treated as extension of grey MM, where its operators are applied separately on each channel and then recombined [8]. However, this procedure does not work in granulometry [2]. Difficulty in color’s orderings is the main reason. Granulometry produces the appearance of false color grains when extended directly to RGB channels. This work addresses this problem. It defines a metric for HSV color space that enables ordering, so that granulometries produce the expected results i.e. without the creation of new colors [4]. The proposed metric is applied to synthetic and real images to illustrate its efficiency. 2. BACKGROUND Granulometry can be defined as the process of determining the size distribution of certain structures like sedimentary rock. One of the most powerful tools for image-based granulometry is mathematical morphology which is a theoretical model built upon lattice theory and topology. It is based on a set of fundamental operators which can be described in terms of Minkowski sum and subtraction operations [1]. 2.1 Morphological image processing Morphological image processing considers the space in which the structures are embedded as n-dimensional integer lattices in a Euclidean space E. Its operators are based on four primitive fundamental operators: dilatation, erosion, opening and closing. Let A and B be two sets in P(E). Table 1 defines the fundamental mathematical morphology operators: Table 1. Fundamental operators with B x = {y : y-xE} dilatation } : { ) ( = x B B A x A δ erosion } : { ) ( A B x A x B = ε opening )) ( ( A A B B B ε δ = closing )) ( ( A A B B B δ ε = In morphological image processing, one of the sets (for example, the set B in Table 1) is typically known as structuring element and is the element that intuitively operates on the other set (A in the formulation presented in Table 1) analyzing, identifying or modifying its subjacent shape structures according to the behavior specified by the operator. Initially, morphological image processing was developed for binary images. In order to define a gray level morphology it was necessary to find analogous notions to the notions of subset, union and intersection, which are the basis of the fundamental operators. In gray level morphology, image structures are appropriately modeled as discrete functions, so the notions of subset, union and intersection must be described in terms of such functions The notion of subset in binary morphological image processing naturally induces an ordering relation on the sets of elements. So the analogous notion for gray level morphology must define an ordering relation between functions. Let f and g bet two functions. Then, f is considered lower than g (gf) only if:

[IEEE 2008 International Conference on Systems, Signals and Image Processing (IWSSIP) - Bratislava, Slovakia (2008.06.25-2008.06.28)] 2008 15th International Conference on Systems,

  • Upload
    e

  • View
    225

  • Download
    5

Embed Size (px)

Citation preview

Page 1: [IEEE 2008 International Conference on Systems, Signals and Image Processing (IWSSIP) - Bratislava, Slovakia (2008.06.25-2008.06.28)] 2008 15th International Conference on Systems,

Introducing a New Metric for Automatic True Color Images Granulometry

A. Montenegro, E. P. Calixto, A. Conci and E. Clua Departamento de Ciência da Computação Universidade Federal Fluminense (UFF)

Rua Passo da Pátria 156 - Bloco E - 3º andar São Domingos, Niterói - RJ - CEP: 24210-240

Phone +55 (21) 2629-5665/5666 E-mail: {anselmo, ecalixto, aconci, esteban}@ic.uff.br

Keywords: metric spaces, granulometry, color mathematical morphology.

Abstract – Mathematical morphology (MM) is a powerful tool for automatic extraction of grain-sized data from digital images. In many cases, color information can be quite useful for the enhancement of the results obtained. Nevertheless, the definition of color MM, as simple extension of gray level MM, does not work appropriately for granulometry applications. The problem is that fake colors arise in the results obtained by applying morphological granulometry separately for each color component in the recombination stage. In order to solve this problem it is necessary to define an ordering in an appropriate color space. This work proposes a new metric defined in the HSV color space. We named this chromaticity constant. The validity of this is shown by the experimental results obtained by the application of the metric to synthetic and real images.

1. INTRODUCTION The grain-size distribution or granulometries is one of

most traditional mathematical morphology (MM) applications since the MM development in the 1960´s by G. Matheron [1930-2000] and J. Serra [1]. It is used to analyze the structures of elements and to identify these elements as well. Widely explored in bilevel and grey scale, the morphology of true color images presents aspects for deeper researches. Color and multi-channel MM in many cases can be treated as extension of grey MM, where its operators are applied separately on each channel and then recombined [8]. However, this procedure does not work in granulometry [2]. Difficulty in color’s orderings is the main reason. Granulometry produces the appearance of false color grains when extended directly to RGB channels. This work addresses this problem. It defines a metric for HSV color space that enables ordering, so that granulometries produce the expected results i.e. without the creation of new colors [4]. The proposed metric is applied to synthetic and real images to illustrate its efficiency.

2. BACKGROUND

Granulometry can be defined as the process of determining the size distribution of certain structures like sedimentary rock. One of the most powerful tools for image-based granulometry is mathematical morphology

which is a theoretical model built upon lattice theory and topology. It is based on a set of fundamental operators which can be described in terms of Minkowski sum and subtraction operations [1].

2.1 Morphological image processing

Morphological image processing considers the space in

which the structures are embedded as n-dimensional integer lattices in a Euclidean space E. Its operators are based on four primitive fundamental operators: dilatation, erosion, opening and closing. Let A and B be two sets in P(E). Table 1 defines the fundamental mathematical morphology operators:

Table 1. Fundamental operators with Bx = {y : y-x∈E} dilatation }:{)( ∅≠∩= xB BAxAδ

erosion }:{)( ABxA xB ⊂=ε

opening ))(( AA BBB εδ=

closing ))(( AA BBB δε=

In morphological image processing, one of the sets (for

example, the set B in Table 1) is typically known as structuring element and is the element that intuitively operates on the other set (A in the formulation presented in Table 1) analyzing, identifying or modifying its subjacent shape structures according to the behavior specified by the operator.

Initially, morphological image processing was developed for binary images. In order to define a gray level morphology it was necessary to find analogous notions to the notions of subset, union and intersection, which are the basis of the fundamental operators. In gray level morphology, image structures are appropriately modeled as discrete functions, so the notions of subset, union and intersection must be described in terms of such functions

The notion of subset in binary morphological image processing naturally induces an ordering relation on the sets of elements. So the analogous notion for gray level morphology must define an ordering relation between functions. Let f and g bet two functions. Then, f is considered lower than g (g≤f) only if:

Page 2: [IEEE 2008 International Conference on Systems, Signals and Image Processing (IWSSIP) - Bratislava, Slovakia (2008.06.25-2008.06.28)] 2008 15th International Conference on Systems,

i. fg DD ⊂ .

ii. )()(, xfxgDx g ≤∈∀ ,

where Dg and Df are the domains of g and f respectively.

The intersection of two functions f and g can be defined in terms of the notion of minimum meanwhile the notion of union is defined as the maximum of two functions as shown in Table 2.

Table 2. Minimum and maximum of f and g. Both functions are

not defined if x does not satisfy the domain constraints. minimum

gf DDxxgxfxgf

∩∈=∧ )},(),(min{))((

maximum

gf DDxxgxfxgf

∪∈=∨ )},(),(max{))((

Based on these new defined notions, it is possible to

redefine the four basic morphological operators for gray level morphology. Other important concepts in gray level morphology are the concepts of umbra and surface which enable an elegant link between the operations in binary mathematical morphology and gray level mathematical morphology [1].

2.1 Morphological granulometry

The theoretical foundations of mathematical

morphology were developed to characterize images by quantitative parameters as size distribution or granulometry [2].

Formally, a class of mapping of sets Ψ =ψλ, depending on a parameter λ≥0, is a morphological granulometry if and only if, Ψ satisfies the following properties:

i. AA =)(0ψ and )()(, AAu u λψψλ ⊂≥ . ii. )()(,,0 BABA λλ ψψλ ⊂⊂≥ iii. )()]([)]([,0, },max{ AAAu uuu λλλ ψψψψψλ ==≥

According to Serra [1], any mapping of sets that

satisfies the conditions above can be considered as granulometry. Intuitively those mappings act as strainers of different sizes that retain larger pieces while smaller pieces pass through, enabling an analysis of the distribution of the structures of different sizes.

There are different approaches for morphological granulometry. The most widely used are linear granulometry and opening granulometry [1]. Opening granulometry works with a set of structuring elements of increasing sizes (parameterλ). At each step, the current structuring element, by operating on the image, maps the current set onto a new one in which part of the elements are removed. All tests in this work were obtained by using opening granulometry and the granulometry by reconstruction in which the structures are reconstructed, at each step, based on conditional dilatation [1].

3. COLOR SPACES X GRANULOMETRIES

In order to apply granulometry techniques on colored images it is necessary to define a mathematical morphology in color spaces. This is considerably more intricate due to the higher dimension nature of color spaces which makes difficult the definition of an ordering relation. Another problem is that not all color space models are appropriate for such generalization. One aspect that must be taken into account is human perception of color.

An ordering relation can be defined using the principles of vectorial ordering [5]. The three main categories of ordering based on vectorial ordering principles are: marginal ordering (each component is evaluated separately and the results combined a posteriori), reduced ordering (transforms the vector space in a scalar value) and lexicographical ordering (colors are ordered component by component in a pre-defined sequence). Examples of works that use one of this categories are [3],[5],[6] and [7].

It is difficult to imagine an order or rank in the RGB color space. The human perception of the color seems to be more related with its representation as intensity, saturation and chrominance, chrominance, with intensity changes enough high to be able to recognize the majority of objects.

The extra information that a color image conveys can then be found in the chromaticity. For this reason, MM of true color images appear to be a natural extension of grey MM using adequate colors spaces (e.g. HSV, HIS, HSL, etc). However, it is impossible to combine directly the hue channel (H) with the saturation channel (S): The hue is an angular value, being able to change between 0° and 360° whereas the saturation values range is 0-255.

Hanbury and Serra [3] define an ordering in space HSL that considers components H and S. Their ordering is called saturation–weighted hue: it computes a new H’ value for each vector on HLS. Let ci = (Hi, Si, Li) be a color in HSL space. Then a new hue component Hi’ is computed by the following equation:

⎪⎪

⎪⎪

≤≤+

≤≤−

≤≤+

≤≤−

=′

oo

oo

oo

oo

360270),3(90,inf[

270180),3(90,sup[

18090),1(90,inf[

900),1(90,sup[

iii

iii

iii

iii

i

HSH

HSH

HSH

HSH

H (1)

After the determination of the ordering based on the

saturation-weighted hue, the original hue is restored to avoid the appearance of false colors in the remaining process using such formulation. The main feature of this metric is that maximum-chrome or purity colors present greater probability to be on the limits of the ordering relation defined on the color space. Serra’s strategy is an example of reduced ordering.

The work presented here considers this problem on HSV color space and proposes another metric. This new metric is also based on a combination of hue and saturation however it aims to define a constant which represents the most significant component between the considered values for saturation and hue.

Page 3: [IEEE 2008 International Conference on Systems, Signals and Image Processing (IWSSIP) - Bratislava, Slovakia (2008.06.25-2008.06.28)] 2008 15th International Conference on Systems,

4. CONSIDERING A NEW METRIC ON H AND S CHANNELS

First of all, the objective is to order the chrome

sensation. The V component is left aside while the H and S channels are normalized (between 0 and 1). Although, given the nature of the color space, values 0 and 1 have different meanings in each case. They represent maximum and minimum saturations, but for the hue channel they represent the same color (0° = 360°), as shown in Figure 1. Due to this aspect, a function called hue distance is defined. This represents the smaller angle between two hues, a form of minimum hue.

⎪⎪⎩

⎪⎪⎨

>−−−

≤−−

=o

o

o

o

o

180||,180

||360

180||,180

||

),(

baba

baba

ba

hhhh

hhhh

hhdH (2)

With this, the biggest possible distance between any hue

values is 180°. Then, with hue and saturation being represented on the same scale, we can reduce them to one value. The proposed metric transforms these into only one scalar called chromacity constant. Let a and b be two colors with hue and saturation values given respectively by the pairs (ha,sa) and (hb,sb). The chromaticity constant is defined as the maximum between the absolute saturation difference and the minimum hue, as show in the equation below:

)),(|,max(|),( baba hhdHssbac −= (3)

In [4] it was demonstrated that this is a metric for HSV

space, and then can be used for ordering in this space. Figure 2 shows the geometric representation of HS

plane covered by the proposed metric, considering red as the lowest possible color.

Fig. 1. (a) Normalized saturations. (b) Normalized hues.

In this example, only the color of maximum intensity

value is considered, because the proposed metric does not consider the V component. Region (a), in Figure 2 shows all the colors that presents the chromaticity constant equal or less than ¼=0.25 in relation to the minimum color. Region (b) shows the colors where this new component is equal or less than ½=0.5, and so on. Moreover, this minimum color can be defined in each case. For granulometries this must be the background color.

Fig. 2. HSV color space covered by the proposed metric with

maximum intensity and red on initial position.

5. EXAMPLES Here we present some results of granulometry for true

color images using the chromaticity constant metric proposed. The method was implemented in Matlab version 6.5 and part of the code is available in [4]. For each image on the following examples, the color of background is chosen as the minimum color of the space. Initially synthetic images had been used as tests of the proposed metric on different minimum color (background). Figure 3 is a controlled experiment, where the amount and size of the grain are known. The only difference between these images is the color of the background and the color of some grains, which changes at random in each one. Grains compositions and areas are described in Table 3.

Fig. 3. Synthetic images used as tests.

Table 3. Number of grains and occupied area.

Figure 4 presents the resulting pattern spectrum of

opening granulometries and granulometries by reconstruction for every image (Figure 3). All images produce same results. Observe that the results with reconstruction (also called conditional granulometries) presented in Figure 4 correspond to the values in Table 1.

Fig. 4. Pattern spectrum for the images in Figure 3.

Page 4: [IEEE 2008 International Conference on Systems, Signals and Image Processing (IWSSIP) - Bratislava, Slovakia (2008.06.25-2008.06.28)] 2008 15th International Conference on Systems,

In the next example, this metric is applied to the real grains presented in Figure 5. There are 6 grains of pea, 7 grains of corn, 4 white beans grains, 8 grains of rice and 5 black beans grains. In each case two background colors are considered. The contrast is better for the left image.

Fig. 5. Real image composed of same grains.

Figure 6 shows the results of the proposed method applied to the test image on the left with blue background (H=204, S=0.93, V=0.70). The images were produced by granulometry by reconstruction. In each pass a total of 30 iterations were performed. It is possible to see that as the granulometry is performed, the color variations in the grains disappear and in the final iteration only solid colors remain. In spite of color variation, the shapes of the grains are not modified. The patterns observed in the final images do not influence the counting of the grains as the remaining colors are close to the background color. This occurs because the metric here proposed does not consider intensity differences.

Fig. 6. Granulometry results in color space for the test image with blue background.

Figure 7 shows the pattern spectrum of the granulometries by reconstruction of the images in Figure 5. The pattern spectrum measures the area (volume) reduction from level λ to λ+1. The large values of λ in the pattern spectrum are associated to the more frequent grain-sizes.

Fig. 7. Pattern spectrum of the granulometries by reconstruction

of images presented in Figure 5.

6. CONCLUSION

Synthetic and real images tests showed that the

proposed metric produces excellent results. The same occurred in the comparative tests with other works [4]. False colors are not detected with the experiment. However, the background of the images is important for the result with real and transparent grains (as the rice ones), especially its contrast and regularity in the chromatic sense (the luminance does not present influence). To minimize this, a first opening operation in the image can be made to eliminate small chromatic variations [4].

REFERENCES

[1] J. Serra, Image Analysis and Mathematical Morphology Volume 2:, Theoretical Advances, Academic Press Inc., 1988.

[2] G. Matheron., Random Sets and Integral Geometry. John Wiley & Sons, Ecole des Mines de Paris, 1975

[3] A. Hanburry and J. Serra, "Mathematical Morphology in the HLS Color Space", Proceedings of the British Machine Vision Conference - BMVA, Manchester, 2001, pp. 451- 460.

[4] E. P. Calixto, "Granulometria morfológica em espaços de cores: estudo da ordenação espacial", UFF, M. Sc. Dissertation, 2005 (in Portuguese). Title in English: Morphological granulometry in color spaces: a study in spatial ordering.

[5] V. Barnett, The ordering of multivariate data. J. R. Statist. Soc. A, Vol. 139, p 318-355, 1976.

[6] M. Köppen, Ch.. Nowack and G. Rösel, Pareto-Morphology for Color Image Processing, Department of Pattern Recognition, Fraunhofer IPK-Berlin, Link: visionic.fhg.de/ipk/publikationen/pdf/scia99.pdf. Link no longer available.

[7] G. Louverdis, I. Andreadis and P. Tsalides. Morphological Granulometries for Color Images. Proc. 2nd Hellenic Conf. on AI, SETN-2002, Xanthi, Greece, 2002, pp. 333-342.

[8] E. Aptoula and S. Lefevre, On morphological colr texture characterization, Proc. 8th Int. Symposium onMathematical Morphology, Rio de Janeiro, Brazil, 2007, pp. 153-164.