Image Segmentation Using Fuzzy Inference System on YCbCr Color Model

,


Introduction
Color perception begins with a chromatic light source -which is electromagnetic radiation with wavelengths between 400 and 700 nm approximately. Part of the radiation, which is reflected on the surface of objects, is a scene and the resulting reflected light reaching the human eye, generates the feeling of color perception [1][2][3][4].
Brightness is the luminance or relative darkness of the color, hue is the color reflected or transmitted through an object and, saturation (also called chroma) represents the contribution of white color existing in proportion to the hue, or more precisely, the color purity [2]. This is the basis of the YCbCr color space.
The color segmentation in the computer vision field is important for pattern recognition and image processing tasks purposes. Segmentation is the process of partitioning an image into regions of interest (sets of pixels), with homogeneous features; namely, they can share one or more characteristics, such as shape, color, texture, lighting, etc.
The color of the shapes within an image can be used to simplify the identification and extraction of the regions of interest. They can be recognized as separate objects.
Image segmentation methods have recently been proposed, many of them based on Neural Systems and Fuzzy Logic. A segmentation system based on neural networks has been proposed by Ganesan et al. [5], they performed an unsupervised competitive neural network based in Kohonen's self-organizing maps (SOM). They used color satellite images. The images are segmented in RGB and HSV color space. The main problem of his work is the high computational cost because to obtain the value of a pixel, with the structure presented, 48 connections are necessary, increasing with this the number of operations. In addition, the weights of each node should be initialized before training data and ASTESJ ISSN: 2415-6698 the performance of the training depends on the initial data. If the initial data is not adequate, the process will have to be repeated. The YCbCr color model has been used for skin detection and, in combination with the fuzzy model, has presented great performance for image segmentation [6,7]. The Cb and Cr components determine the skin tonality. Tonalities are represented by histograms. Fuzzy inference models to determine the pixels representing the possible regions of skin within an image can be applied to them.
When looking for adaptability in fuzzy systems to model information in an unsupervised way, different proposals have been presented for the image segmentation using the classical algorithm of Fuzzy C-Means (FCM) [8][9][10]. G. Liu et al. [8] introduced a dissimilarity function by combining region-based and pixel-based distance function, in order to enhance the relationship between pixels which have similar local characteristics. This idea is retaken in this work, since, for the distribution of fuzzy sets, local information is considered.
Liu and Wang [11] developed a method of fuzzy color recognition and segmentation of robot vision scene based on the combination of fuzzy color quantization and edge extraction of HSV color space. This work was supported in part by the same idea; the triangular membership functions in the input of the system and the Mamdani-type inference are used. In contrast with the work mentioned above, we used YCbCr color space, fuzzy singletons are used as output function and the output value is obtained by the Weighted Average Method (WAM) [12,13].
One of the reasons for using the YCbCr color space is that it is standardized for the transmission and reception of digital video, (ITU-R Recommendation BT.601-5 [14]), therefore, most of the sensors used in the acquisition of video implement it. We used a device that has as main output signals, the YCbCr color space, eliminating the need to perform the transformation to another color space and improving the response time.
The fuzzy singleton function and WAM are used to simplify the mathematical calculation of the output value for the fuzzy inference system. Distribution of input membership functions for classification of hue is made on the Cb and Cr components of YCbCr color space (see Figure 1). This paper is organized as follows. In Section 2, we give a brief introduction to the YCbCr color space. The basis of fuzzy logic is discussed in section 2. Section 4 presents the fuzzy rules used by the system. The application of segmentation system is presented in Section 5. The discussion of the results is made in Section 6. Section 7 presents the conclusions.

YCbCr Color Model
It is a nonlinear encoding of the RGB color model. The YCbCr model components determine the luminance and chrominance. "Y" is the contribution of light in the pixel; "Cb and Cr" are the blue and red chrominance components, respectively. The combination of Chroma values are different colors (color coordinate system), but the luminance value "Y" determines the brilliance of color, specifically, for low values of "Y" the colors will be dark; otherwise, the colors will look very bright with a hue close to white. The three cases for the variation of illumination "Y" are shown in Figure 2, as it can be seen, the color coordinate system changes its hue.
The YCbCr space is commonly used in vision-based hardware systems and digital video transmission. It is defined for standarddefinition television and digital transmission purposes by the ITU-R BT.601. One of the main features of this model is that the brightness component "Y" is independent from the chroma components; because of this, this color space can be used to solve illumination variations in non-controlled environments.
The below mathematical expression is given following the recommendations of the ITU-R BT.601 standard (chapter 3.5.2 [14]) for a Cr and Cb re-normalized system.
Equation (1), describes the RGB color space conversion to the YCbCr space. Where matrix A represents the re-normalized coefficients of the horizontal vectors Y, Cb and Cr respectively. C is the matrix that re-measures the data, transforming the 220 and 225 levels, to 256 (8-bit digital representation). Before applying (1), the lowest value for Y, Cb and Cr is 16 and the highest value for Y is 235 and Cb, Cr is 240. After applying (1), the lowest value is 0 and the highest value is 255, for the three components. This mathematical procedure is similar to the function RGB2YCBCR included in the MATLAB's digital image processing toolbox. This value transformation, 256 values, will be used in this paper.

Fuzzy Logic
In the YCbCr color space, the transition between a color and another one does not have a defined borderline; namely, it changes gradually from one hue to another. Due to the fact that fuzzy systems work with uncertain data, this system is very appropriate.
A fuzzy set is associated with a linguistic value that is defined by a word, an adjective or a linguistic label. In the fuzzy set, the membership function can take values in the interval (0, 1), making a gradual transition between zero and one, and not discreetly one such as that in classical sets.
The fuzzy set in a universe of discourse can be defined as shown in (4).
Where ( ) is the membership function of the variable x, U is the universe of discourse. The closer the color of the set membership to value 1, the greater the variable x belonging to the set color will be.  Figure 3) which describes the different membership levels [12]. The parameters (a, b, c, d) determined the slopes in the boundary lines of the fuzzy sets. As a fuzzy set, it can be inferred that the maximum level of membership is equal to one, the slope of a line determines the different membership levels and the nonmembership is equal to zero. For this system, the overlap in the fuzzy sets describes the inaccurate transition between the hues, as detailed in Figure 4.

Fuzzy Rules
A fuzzy system inference uses the expert's knowledge to generate a knowledge base, which will give the system the ability to make decisions. This knowledge base is modeled by creating a rule set, which generates the system output; in this case, it is the membership of pixels within an image above a set or another.
As mentioned, the component "Y" represents the contribution of light existing in a color. In Figure 5, a graphical diagram of the inference of nine fuzzy rules when the colors are considered dark can be seen. That is, when luminance "Y" has a low value. (The first nine rules in Table 1).  Table 1, we can see twenty-seven diffuse rules, which are all combinations when we consider three fuzzy sets for each component of the color space YCbCr.
To obtain a crisp output or output image (segmented regions), we need a defuzzification process. The inputs of the defuzzification process are the values of fuzzy membership functions Y, Cb, and Cr, and the output of the defuzzification process is a single number (or the value of one pixel). Many defuzzification techniques have been proposed in literature [12,13]. The most commonly used method is the WAM (also named centroid). In WAM, the defuzzifier determines the weighted mean (or the center of gravity) of the fuzzy membership functions implicated in each of the knowledge base rules (Table 1). It is given by the algebraic expression in (6).
Where ∑ denotes an algebraic sum and A represents the different colors expected at the output, see Table 1.

Segmentation of Hue Using Fuzzy Logic
The YCbCr color space has a color chart consisting of the combination of the Chroma belonging to the red and blue (Cb and Cr) and different levels of luminance (Y), see Figure 2.
For the universe set "luminance", we consider three linguistic labels, "Black" which represents the low contribution of light, "Color" where it is considered the optimal lighting to perceive the tone of a color, and "White" representing a high contribution of light, see Figure 6.
In order to reach the perception of color, the presence of luminance without reaching saturation will be necessary. Different combinations of the components "Cb and Cr" typify the color. By taking this into account, the fuzzy sets are generated in their combination representing the different colors that the system can classify. Figure 6: Fuzzy sets for the universe set. "luminance"; Y Three fuzzy sets are defined, each with their linguistic label respectively for each Chroma component. "Low" when the Chroma saturation in blue or red is low, "medium" when the Chroma saturation is medium, and "high" when the Chroma saturation is high, as detailed in Figure 7. The values values (a, b, c, d), which are parameters of (5), represent the form of all the fuzzy sets in a universe set (see Figure  8). By varying these parameters, different slopes in the boundary lines of the fuzzy sets are generated, modifying the zone that represents uncertain data.
Also, it is possible to find a particular hue value by modifying these parameters. For example, if we are looking for red color and its different hue values (the red color region is in the upper left corner in the color palette as shown in Figure 8), it is necessary to expand the region covered by the "Low" set in "Cb" and the "High" set in "Cr", which means that the value of the parameter "a" in "Cb" should be increased and the value of the parameter "d" in "Cr" should be decreased. The region of interest is then amplified as shown in Figure 9. The numerical values of (a, b, c, d) parameters, which are used in the fuzzy sets for red segmentation, are shown in Table 2. One of the images tested with the proposed fuzzy inference system is shown in Figure 10. It contains an object with a red hue. In order to explain the different steps that the fuzzy logic segmentation system follows, a pixel will be taken from the processed image. This selected pixel corresponds to a reddish object, and it has the following values for Y=143, Cb=94 and Cr=188. The membership values obtained by processing the pixel described above are shown in Table 3.
The membership value shown in Table 3 are introduced in (4) to obtain the numerical values of the system output. Variables named "S" represent the output fuzzy sets (fuzzy Sigleton's), each of them are located at the expected output value; for example, S10 represents the red color, suggesting that the pixel in the output image will have R = 255, G = 0, B = 0 as a numerical value as long as the numerical value obtained in (3) is similar to S10. Table 4 lists the values of all the fuzzy singleton's.   To form the output image, each pixel is is processed in the same way. The used method for image processing is shown in Figure 10. At first, the original image is in RGB color space (Figure 10 (a)). Then, the image is transformed into YCbCr color space (Figure 10 (b)) and finally, the fuzzy inference system is applied to the result image (Figure 10 (c)). It is worth noting here that the output singleton sets are represented again in RGB color space to be displayed on screen.

Experimental Evaluation
To evaluate the effectiveness of the segmentation system by fuzzy logic, the segmentation of the green hue in the original image of Figure 11(a) was proposed. This photo was taken in the laboratory, in a closed room, under semi-controlled lighting conditions and the changes in illumination inside the photo can be noticed. The image contains a green area that simulates the conditions of a (small) soccer field, a red ball and white lines that define the green area.
This particular photo was chosen because our segmentation system will be a part of the vision system of a robotic prototype that serves as a football player.
The segmentation system was designed considering only the red, green and blue contributions in the RGB color space model, in order to define the color of an object and matching the results from the opposite system. The classification in the RGB segmentation was made by obtaining the Euclidian distance between each one of the image's pixels and the mean of the pixels (red, green, blue) that defines the green color of the image.
The code was developed based on Matlab programming language in its version R2010a (see Appendix A), on a computer with an Intel Core2 Duo T6400 2 GHz. Images were obtained with a Kodak Easy Share CD14 with a resolution of 1280x960, JPG format.
The execution time of the segmentation system when using RGB color space was of 1 min.15 sec. For YCbCr color space it was 55 sec.
The difference between the RGB and YCbCr execution times is mainly due to the fact that, in the RGB color space, each component contributes to obtain a color hue so that the three components are an input of the fuzzy system; in the YCbCr, the component "Y" determined, as a first step, if the pixel has low lighting (black), high lighting (white) or if the lighting is good enough to perceive the hue of a color. The pixel Chroma components to determine the membership level are discussed only in the latter case. For segmentation in YCbCr, we transform the original image into this color space, due to fact that the image is in RGB color space, Figure 11(a), the rgb2ycbcr function was used for this purpose, which is part of the "image processing" toolbox of Matlab, (see Figure 11(b)). In Figure 11(d) the result of the segmentation can be observed. The change in hue due to the variation of lighting was considered in the YCbCr color space, so that, when the images in Figure 11(c) and Figure 11(d) were compared, as expected, we observed a better performance of the segmentation system in YCbCr.
The variation of lighting is not considered for the RGB, so that, the pixels in the top center of the image Figure 11(c), were classified as non-green hue.
In Figure 11(a), three main regions can be seen, one of them is the green region (region of interest), and two more regions that are covered with yellow and gray pixels. The last two regions are the result of the membership levels to the fuzzy sets of the remaining pixels.
The values for the parameters (a, b, c, d) of the fuzzy sets which are used for the segmentation of green color in YCbCr are shown in Table 5. Another important point to mention is that the equations to conform the fuzzy sets are relatively simple and only require 4 parameters to generate the fuzzy sets that cover a universe set. We have taken advantage of this simplicity and it was implemented in a segmentation system in an FPGA.
A test showing how to generate an output image with three hues by adding the segmentation of green and red color from an input image is shown in Figure 12. The image obtained in Figure  12(d), may be used for classification and recognition of objects contained therein.

Conclusion and Future Works
This paper proposes an application of segmentation of regions in images using fuzzy logic. It exploits the ability of fuzzy sets for modeling accurate data to interpret the transition from one hue to another by using the blue and red chromas in the YCbCr color space.
Trapezoidal sets are proposed for mapping of the chroma to membership levels and is considered the ITU-R Recommendation BT.601-5 in order that the system can be applied to most sensors for the acquisition of digital video.
The combination of the YCbCr color space with the fuzzy inference system demonstrated high adaptability to model different color hues, so different color hues can be segmented into an image.
By the simplicity of the equations, both to generate the fuzzy sets and the calculation of the value of the output of the system, it is possible to have a system of low computational cost and high speed to obtain a response.
MATLAB programing language was used in its version R2010A to develop the system and was applied in two color spaces, RGB and YCbCr, execution times were 1 min. 15 secs and 55 secs, respectively.
Due to the simplicity of the formulas that are used to develop the fuzzy inference system, the implementation in hardware is feasible. In our laboratory, we have implemented the proposed system, using the Spartan 3E development board which contains an FPGA xc3s500e from XILINX Company. The proposed segmentation system has been applied in the object tracking and orientation of robots. Different colors and shapes have been presented to a robot and the execution times obtained allow working with images with continuous sequence.