Vous êtes sur la page 1sur 4

A Color Classification Algorithm

Dr.Kansei Iwata , Dr.Gabrie1 Marcu Graphica Computer Corporation 6-2 1-6 Nagayama, Tama-shi, Tokye206, Japan
Abstract The color classificationprocess requires to partition a
color image into a set of uniform colored regions. This paper presents a method of automatically classification of a color picture, k e d on the advantages of high speed binary tree splitting algorithm[3] and completed wilh a stopping criteria derived from color cluster detection methods[l,2]. The histogram of distance of the current color point to the center of the investigated cluster is analyzed to stop the binary splitting algorithm. The color space was divided and labeled accordingly to the closest color cluster or region corresponding to a color of the color set. A dynamicallydividing method of the color space was used. A post-processing algorithm enables to filter the unwanted tranritioncolors by absorbtionand erosion.
pixel mapping criteria can be the euclidean distance or other distance, i.e. Mahalanobis distanceP1, inside the color space. Dithering[41 or error diffusion techniqueD1, can also be used for suitable color selection from the color palette. This paper presents a method of automatically classification of a color picture, based on the advantages of high speed binary tree splitting algorithmP1 and completed with a stopping criteria derived from color cluster detection methods [1.21. The color classification problem is divided in two parts: - finding the color classes set used to represent the picture; - mapping each pixel of the original image into one color class of the color set.

2. Designing the color classes set


1. Color classification
The color classification process requires to partition a color image into a set of uniform colored regions. The color classification process is closely related to quantization and also to segmentation of the color images. The difference resides in the purpose of each process. The quantization process ~ e a s relative higher number of colors to represent as much as accurate the classified picture, but the methods used to identify the color clusters can be used for color classification . Different cluster detection methods have been proposed for automatically color classification,as it was introduced by Tominaga[ll or by Jolion, Meer and Batauche[Zl. The binary tree splitting method, as it was proposed by Orchard and Bouman[31. represents another solution for automaticallydesigning the color set used to represent the classified picture. The color classified picture results by mapping each pixel color of original picture into the closest color of the color set, called color palette or color classes set. The The designing of the color set used to represent the classified picture was accomplished using a hybrid method between binary tree splitting algorithm combined with a cluster detection stopping criteria[lszl. The binary splitting algorithm is briefly described bellow. Denoting by Q the color data that must be partitioned into the color classes set S,. Q, = { ci , i=1,2,...B}, and ci = ( rj , gi , bi ) is the pixel color with the r,g,b color components and N represents the number of the elements of the image. The algorithm conducts to a binary tree structure of the partition S,. The color region with the maximum variance is selected to be splitted. Each partition of a node QI representing a subset of Q, conducts to two disjunct subsets Q21 and Qzl+l. Each partition of a node decreases the total square difference between the quantized image and original image. The splitting criteria o a node requires to determine the f direction in which the color cluster of that node has the greatest component variation and to divide the cluster by a

726

0-8186-4960-7/93 0 1993 IEEE $3.00

plane normal to that direction into two regionsP1. The maximum variance of the cluster is determined from the second order statistical properties. Specifically, for each region, 1, which must be splitted, the mean value, ml, and the covariance matrix, C1, a r e computed:

about color cluster must be analyzed. The distance from a color point, q to the center of the . cluster. for example 1 cdor region, is defined using the covariance matrix. as follows:

-*

q =l/Nl . ci , and Cl = l / N l . x ( q - ml y . (ci - ml ).


The principal eigenvector, U 1 1 , of the covariance matrix, whch corresponds to the maximum eigenvalue. named principal eigenvalue of the covariance matrix, determines the direction of the maximum variance of the cluster. The principal eigenvalue of the covariance matrix is used as a measure of the reduction of the total square difference between the classified image and the original image. This is the reason for which the node to be splitted is the node with the maximum eigenvalue over all unsplitted nodes,corresponding to the leafs of the tree. The color region QI. corresponding to the node 1, is sorted into the sets:

and is referred as the squared Mahalanobis distanceP1. The histogram of the Mahalanobisdistance corresponding to the points in one color region, gives information about the remaining color cluster distribution in that region. If a Gaussian distribution of the color points in the clusters which composes the investigated region is assumed, it can be delimitatedfew cases: 1. If the histogram is monotone descendent, as in fig.la., the color duster corresponds to a single color class, and the color cluster detection for that region is stopped;
pixels

I
I

(a) single cdor c l u r

Until here the algorithm description is equivalent to the splitting tree algorithm introduced by Bouman and OrchardPI. The main disadvantage of this algorithm is that the number of colors in the color set must be prefixed, which is perfectly well for color quantization where the color palette has a predefined numbers of colors, but does not work in color classification case, where the number of colors must result from the analysis of the picture. We didn't find an explicic correlation between maximum principal eigenvalue and the number of color classes determined by the binary tree splitting algorithm. But it can be observed that, from step to step, the principal eigenvalues of the covariance matrix decrease. This is a measure of how much the identified color clusters are spread in the color space. When the maximum principal eigenvalue of the covariance matrix over all the leaf of the tree reaches a lower threshold value, a cluster detection criteria is added to the splitting method. in order to supply it with a stopping criteria In practical implementation,lO%of the maximum eigenvalue used in first splitting step was used as the threshold value. From one step to another of the algorithm, the colors to be detected becomes more undiscernible, and the color splitting process requires an increased accuracy. It is intuitively that more information

Fig. 1. Cases of the square Mahalanobis distance histogram

2. If the histogram has mountains and valleys, as in fig.l.b., it can be assumed that more than a single color duster is present in the investigated region and the binary tree splitting method can continue. To detect if the histogram has no significant mountains or valleys, or a noisy distribution can be assumed the investigated region is spatially filtered to detect the uniformity of the color distribution. The filter is defined by the following transfer function associated t q current o color pixel centered in a square array, A:
0 ,if k - c i k Ltc, ci inside A array; j

ci =
q , in other case;

where, lcj - q I represents the tridimensional euclidean distance between cdors q and cj. and Ltc is a parameter of filtering process, as a measure of the color uniformity of the investigated region. The result of the filtering process gives a measure of the color noise in the investigated region. If the number of not-zero pixels after the filtering process is greater than a threshold limit, the splitting algorithm continues. In other case, the noisy region hypothesis is verified and the splitting algorithm stops. In practical implementation 3x3 area with Ltc=12%of the color component range was used.

quarter continues.

3. Mapping original colors into the color set


The mapping of the original color data into the color set was performed by labeling all the color space accordingly to the closest detected color cluster. The color space was divided and labeled accordingly to the closest color cluster or region corresponding to a color of the color set. The dividing color space process partiuons the color space into a number of volumes, each one belonging to a single color of the color set. A color corresponds to a point in the color space which belongs to a single volume labeled to a certain color of the color set. A dynamically dividing method of the RGB color space was used. The method divides the color space according to the position of the detected cluster colors. The color volumes are variable size, offering adaptive color resolution to color classification process and an increased accuracy in separation of color. The method divides the RGB color space into a variable number of color cubes. Fig. 4 illustrates the method for only two dimension color space. For easy understanding we assume that each image pixel has only two color components (for example R and G). This will not limited the generality of the method which is s applicable in 3-dimensional a well as in n-dimensional color space, but will simplify the description of the method. In bidimensional color space a color cube is represented by a square area I he color cluster detection process will conduct to a color distribution represented as a number of clusters, as in figure 4a. The dividing process of a square space consists of splitting the square into 4 equal square quarters , by horizontal and vertical cuts. If a quarters contains color levels of a single cluster. this quarter belongs to the color associated to that cluster. If the quarter contains no color levels of the sampled color classes, the quarter class is undecided yet. and it will be established at the end of the dividing process. If the quarter contains more than a single class color levels. the dividing process for this

I
G

class

:.*I

(b) abnormal position of two color clusters


Fig. 4. The dynamicaly color space dividing for color mapping

~-

The dividing process is finished if all the color volumes


contain a single color of the color set, or no color (undecided yet). Any undecided color volume belongs to the closest color class. The Mahalanobis distance is

used. Figure 4a illustrates the dividing process for a normal distribution of the sampled colors of two color classes. The dividing process can continue until a limit size is reached. If the minimum color volume contains more than a single class color levels, a majority decision procedure is used. The color cube will btlongs to that class that has the greater number d rbb color levels inside that cube. This method elipieaiu the ambiguity in color separation decision. TES case is illustrated in the figure 4b. as a good solution for abnormal position of two color clusters.

728

4. Post-processing for elimination of the unwanted transition colors


Figure 2 shows a sample of original picture and figure
the color classified picture, resulted using the classification algorithm and the dynamic color mapping procedure. Singular points and, most unacceptable, unwauted colors at the border of the uniform colored areas are resulted after the color classification process. The idea of elimination o the unwanted colors in color f transitions is based on post-processing of the color sepaaated pictweCsl,by filtering, in order to absorb and to erodate the unwanted contour colors. The absorbtion method uses a majority filter which replaces the central point of a local array by the value of the majority pixels in that array. T h e array may be rectangular or other shape, adapted to the specific properties of the unwanted color edge
3

Fig.5.Post-processed classifiedpicture The erosion method eliminates all the pix& d the transition between two colors. A pixel bdor is ranoved if the local array includes more than a single color representant d the color clasoes e t . The enwion p s is applid after tht abrorbtion pmaus which eliminates al the isdatul points o tht odor d d k d image. l f An expansion proaess f d l w r de t l d~ o n process. tz The expansion pocesr fills dl the QIodated regians with the colors of closeat spatially not erodated dors.The postprocessed picture, fig.5. has the uniform color regions dearly separated.

5. Conclusions
The paper introduced a method of Color dassification based 08 binary tree splitting algorithm d completed with an analysis of the histogram of the Mahalanobis distance, which providea the stopping c-ritena of the method. A dynamically memory mapping is used to reclassify the picture cdofs and the post-processing eliminatea the unwanted transition cdors.

Fig.2. Original p i m e

References [I] S.Tominaga. Color Classification of N t r l Images. aua


Color Research and Applicatk, V17. N4. 1992. [2]J.M.Jolion. P.Maer. S.Batauche. Robust Clurbring wt ih Applications in Computer Vision, lEEE Trans. on Pattern Analysis and Machine I n t e l l i m . V13, N8, 1991. [3] T.Orchard. A.Botim. Color Quantization of Images, IEEE Trans. on Spa1 F g. V33. N12.1991. I [ ]S.C.Welh. 0.J.WilIiamron. S.ECpnie. Dithering for k4 bit True Color Graphics, Computer Graphics and Applications, V15. N5. 1991. [SI K.Iwata, G.Marcu. Few Aspects about Color Classification Poltpmcersing. Joumal of Color Science Association of Japan. V17. N 1 . 1 W .

Rg3.Classified picture

729

Vous aimerez peut-être aussi