International Journal of Science, Engineering and Technology Research (IJSETR)

Volume 1, Issue 1, July 2012

Skin Color Classification Using Fuzzy Logic

Khin Swe Lin, Nang Aye Aye Htwe

Department of Information Technology

Mandalay Technological University

,

1

All Rights Reserved © 2012 IJSETR

International Journal of Science, Engineering and Technology Research (IJSETR)

Volume 1, Issue 1, July 2012

Abstract— In this paper, the color image classification technique that uses fuzzy logic to classify pixels into skin color. Color statistics are collected from RGB color space in this proposed system. The system is divided into four steps. Initially first step consists of the selection of input images which RGB (red, green, blue) values are extracted from the color image, specifically on the user’s forehead, chin and check, averaging the values of each pixel by pixel. The second one is that the crisp input RGB values are converted to fuzzy values by using L function and triangular fuzzy numbering for fuzzification. In the third step, the system implemented inference rules. Finally, Center of Gravity (COG) and Middle of Maxima (MOM) is used to classify skin colors of the human in the defuzzification of the proposed system. The proposed system classifies five skin colors for color images: Black (BL), Dark Brown (DB), Brown (BR), Light Brown (LB) and White (WH). This system is implemented by using Visual C# programming language.

Keywords — Defuzzification, Fuzzification, L function, RGB color space, Triangular fuzzy numbering

  1. Introduction

Fuzzy systems introduced an emerging technology targeting industrial applications in the earlier 1970s. There are many utilities of the fundamental properties of fuzzy sets and fuzzy logic in a host of engineering paradigms, such as classification, pattern recognition, optimization, nonlinear simulation, knowledge-based systems, regression, decision making and possibility theories.

Fuzzy methods also emerge as popular techniques in skin detection. The most popular approach to face localization is the use of color information, where by estimating areas with skin color is often the first vital step of such strategy. Hence, skin color classification has become an important task [1].

The aim of skin color pixel classification is to determine if a color pixel is a skin color or non skin color. Good skin color pixel classification should provide coverage of all different skin types and cater for as many different lighting conditions as possible [2].The proposed system is used RGB color space to classify the skin color.

The choice of color space is considered as theprimary step in skin-color classification. TheRGB color space is the default color space formost available image formats. Any other colorspaces could be obtained from a linear or nonlineartransformation from RGB. Among the existing color spaces are RGB, normalized RGB, Hue Intensity Saturation (HIS), Tint Saturation Lightness (TSL) andYCbCr.RGB color space is the most common color space and iswidely used for processing and storing of digital images. The RGB color space is normalized inorder to reduce the effect of lightning condition and ethnicity [3].

The proposed system is so simple and it will compute each average RGB values from color images (forehead, chin and check). It is proposed to implement a fuzzy based skin color classification system for color images as the fuzzy logic is appropriate to classify the color of human skin via image. The images can be mapped through the use of a fuzzy system to verify if determined pixel regions meet on the color strip that represents skin colors [4].

The rest of this paper is organized as follow. Section 2 discusses the related work for this research. Section 3 introduces skin color classification. Section 4 presents fuzzy inference system. Section 5 displays design and implementation of the system. Finally the conclusion is provided in Section 6.

  1. Related Works

This section discusses about the pervious works of the proposed system. Lior Shamir[5] has described a human perception based approach to pixel color segmentation. Fuzzy sets are defined on the H, S and V components of the HSV color space and provide a fuzzy logic model that aims to follow the human intuition of color classification. The knowledge-driven model allows simple modification of the classification based on needs of a specific application, and the efficiency of the algorithm in terms of the computational complexity makes the proposed method suitable for applications where efficiency is a primary issue.

A. Borji and M. Hamidi [6] have proposed a new method for color image segmentation using fuzzy logic where they automatically produce a system for color classification and image segmentation with least number of rules and minimum error rate. A comprehensive learning particle swarm optimization technique is used to find optimal fuzzy rules and membership functions as it discourages premature convergence. Less computational load is needed when using this method compared to other methods like ANFIS. Large train data set and its variety makes the proposed method invariant to illumination noise.

  1. Skin Color Classification

The study on skin color classification has gained increasing attention in recent years due to the active research in content-based image representation [1]. It has become an important task. The term of skin color is also in itself a subjective idea, especially when based on the point of view of human interpretation.Many techniques have been reported for locating skin color regions in the input image. The proposed system uses RGB color space to classify the skin color as input image.

3.1.RGB Color Space

RGB color space is the most commonly used color space in digital images. It encodes colors as an additive combination of three primary colors: red(R), green (G) and blue (B). RGB Color space is often visualized as a 3D cube where R, G and B are the three perpendicular axes. One main advantage of the RGB space is its simplicity. In computing, the component values are often stored as integer numbers in the range 0 to 255[3][7].

3.2.Calculation o f total average RGB value

The average RGB values of forehead, chin and check are extracted from input image and then these values are used as input value of the fuzzy system. The system calculates R, G and B values separately pixel from input image. The total average RGB value is equal to the sum of average RGB values of forehead, chin and check of color image.

  1. Fuzzy Inference System

The fuzzy inference system is the process of formulating the mapping from a given input to an output. The logic in the system is built by the experience of people who understand the system to be modeled in natural language. The statement of if-then (or rules) is the main mechanism in the fuzzy inference system [8].

Figure 1. Fuzzy Inference System

The components of a fuzzy inference system are the rules, the fuzzifier, the inference engine, and the defuzzifier. The fuzzy inference system as illustrated in Figure.1 is composed of the following four elements:

  • Fuzzifier converts each piece of input data to degrees of membership by a look up in one or several membership functions.
  • Rules determine the closed-loop behaviour of the system. The rules are based on expert opinion, operator experience, and system knowledge.
  • The basic function of the inference engine is to compute the degree of membership function in output fuzzy sets from the degree of membership function in the input fuzzy sets. The inference engine is mainly based on “rules”.
  • The function of the defuzzifier is to convert the degree of membership function in output fuzzy sets to a crisp decision variable of some kind. A crisp output value can be obtained in the defuzzifier process.
  1. Fuzzification

Fuzzification is the process where the crisp quantities are converted to fuzzy (crisp to fuzzy) based on certain membership functions. The conversion of fuzzy values is represented by the membership functions [9]. The proposed system uses triangular membership function and L function for fuzzification.

Image types of JPEG, PNG can be used as input of the color images. The total average RGB values for input image describe the graphical representation of fuzzy numbering such as triangular fuzzy numbering and L function for fuzzification L function was used for BL (Black) and WH (White). Triangular membership function was used for BR (Brown), DB (Dark Brown) and LB (Light Brown). For example, the average R, G and B values are 253, 212, and 188 respectively. These values are used as inputs to the fuzzy system and it will be explained in details as shown in Figure 2.

For R=253

Figure 2. Graphical Representation of Fuzzification for R

In Figure 2, the membership functions for each of the R, in G and B sets are represented in skin color as well as the membership functions for WH, LB, BR, DB and BL skin color fuzzy sets.

For WH, FR (253) = 1 in WH (Because 1 for 0≤x≤1)

For WH, FR (212) == = 0.24

For LB, FR (212) = == 0.76

And then the fuzzy value of B is also computed similarly.

  1. Inference rule

Fuzzy inference systems consist of if–then rules that specify a relationship between the input and output fuzzy sets [7] [8]. The rule base contains linguistic rules that are provided by experts. It is also possible to extract rules from numeric data.

For the above inputs (R=253, G=212 and B=188), four rules are generated based on 125 rules as follows:

If R=WH (1) and G=LB (0.76) and B=BR (0.24)

then Skin Color=LB (0.24)

If R=WH (1) and G=LB (0.76) and B=LB (0.76)

then Skin Color=LB (0.76)

If R=WH (1) and G=WH (0.24) and B=BR (0.24)

then Skin Color=WH (0.24)

If R=WH (1) and G=WH (0.24) and B=LB (0.76)

then Skin Color=WH (0.24)

The proposed system implemented 125 inference rules. All of the combinations of the terms for three fuzzy sets were made to generate inference rules.

There are 125 inference rules as shown in Table I.

Table I

Rules of Inference

Red / Green / Blue / Skin Color
BL / BL / BL / BL
BL / BL / BR / BL
BL / BL / LB / BL
BL / BL / WH / BL
DB / BL / BR / DB
DB / BL / LB / DB
DB / BL / WH / DB
DB / DB / BL / DB
DB / WH / LB / LB
….. / ..... / ..... / .....
  1. Defuzzification

The input for the defuzzification process is a fuzzy set (the aggregated output fuzzy set), and the output of the defuzzification process is a crisp value obtained by using some defuzzification method such as the centroid, height, or maximum [9] [10] [11]. The proposed system uses centroid (center of gravity) and middle of maxima(MOM).

The first method is center of gravity (COG).The centroid (center of gravity) defuzzification method finds the “balance” point of the solution fuzzy region by calculating the weighted mean of the output fuzzy region. The method of centroid defuzzification is described in Figure 4.

The middle-of-maxima method (also called mean-max) is closely related to the first method, except that the locations of the maximum membership can be non-unique (i.e., the maximum membership can be a plateau rather than a single point). This method is given by the expression

(1)

where a and b are as defined in Figure 3 .

Figure 3. Mean-max membership defuzzification method

Figure 4. Centroid Defuzzification Method

For four rules results, skin colors are Light Brown (LB) (0.24, 0.76) and White (0.24) as shown in Figure 4.

Figure 5. Graphical Representation of Defuzzifcation(COG)

The second method is middle of maxima (MOM). It calculated the output value from the maximum fuzzy value as shown in Figure 6. It finds the mean value from the maximum output range. The output value is (146+152)/2 = 149 in equation (1).

Figure 6. Graphical Representation of Defuzzifcation (MOM)

  1. Design and Implementation of the System

The proposed system used as following stages in Figure 7:

Input color face images using image types of JPEG, PNG and any photo size of face color images to select and test forehead, cheek and chin manually.

A rule base containing a number of fuzzy IF-THEN rules

A database which defines the membership functions of the fuzzy sets used in the fuzzy rules

A fuzzification interface which transforms the crisp inputs into degrees of match with linguistic values

A defuzzification interface which transforms the fuzzy results of the inference into a crisp output.

The output displays the skin color of human.

Figure 7. Flowchart of the Proposed System

The cover window of the proposed system is illustrated in Figure 8.

Figure 8. Cover Window of the Proposed System

The user can choose a color image from the database by using the file menu as illustrated in Figure 9.

Figure 9. Choosing Color Image from the Database

After choosing color image, the user can crop manually this color image as shown in Figure 10.

Figure 10. Testing Color Image from the Database

The cropping parts of forehead, chin and check parts are shown in Figure 11.

Figure 11. Cropping Parts of Forehead, Chin and Check Parts

And then, average values of R,G and B can be obtained by clicking “Average RGB of Each Part” button as shown in Figure 12.

Figure 12. Average values of R, G and B of the Proposed System

And then total average RGB value can also be calculated by clicking “Average RGB of Three Parts” button as illustrated in Figure 13.

Figure 13. Total average RGB values of the Proposed System

The fuzzy values can be obtained by clicking “Calculate Fuzzication” button as shown in Figure14. The red lines present the total average R, G and B values of a color image. The “Show Rule” button can be used to see the inference rules.

Figure 14. Fuzzification of the Proposed System

The inference rules based on rule table which is stored in the database And then, the fuzzy values can be presented using center of gravity (COG) and the middle of maxima (MOM) methods by selecting “Calculate Defuzzification from these Rules” button as shown in Figure 15.

Figure 15. Inference Rules of the Proposed System

The fuzzy values by using COG and MOM method in graph are shown in Figure 16. The crisp output values are described to compare two methods (COG and MOM) for defuzzification. Finally, the proposed system will show the output skin color of the given image.

Figure 16. COG and MOM for defuzzification of the Proposed System

The overall accuracy rate of center of gravity method is more efficient than mean-max method for defuzzification. But MM for white and blackskin colors are better than COG. And then, COG for light brown, brown and dark brown skin colors are better than MM. Figure 17 describes comparison of output results of COG and MM.

Figure 17. Comparison of output results of COG and MM

Comparison of output results of COG and MM with graph is shown in Figure 18. COG and MM in graph are blue and red colors.

Figure 17. Graphical representation of comparison of output results

  1. Conclusions

The proposed system can classify five skin colors: Black, Brown, White, Dark Brown and Light Brown. In addition to these five skin colors, this system can be extended to classify six types of skin colors including pink color. Center of gravity (COG) is the most popular method in defuzzification. It is the most widely used technique because, when it is used, the defuzzified values tend to move smoothly around the output fuzzy region. The technique is unique, however, and not easy to implement computationally. Moreover, the images can also be classified as face or non-face material based on this system by using the neural network.

Acknowledgment

First of all, the author is grateful to her parents who specially offered strong moral and physical support, care and kindness. The author is highly grateful to Dr. Myint Thein, the Pro-rector of the Mandalay Technological University for his permission for completion of this paper. The author is deeply thankful to Dr. Aung Myint Aye, Dr. Nang Aye Aye Htwe, and the teachers from Department of Information Technology, Mandalay Technological University, for their overall supporting during the writing of this paper.

References

[1]Brajendra Kumar, M.tech (SE)scholar, LNCT Bhopal 1, “A Review - Skin color based classification using a Bayesian approach”,ISSN NO: 2250-3536 VOLUME 2, ISSUE 2, March 2012.

[2]Son Lam Phung, Member, IEEE, “Skin Segmentation Using Color Pixel Classification: Analysis and Comparison”, 25 Mar. 2003.

[3]Harpreet Kaur Saini*, Onkar Chand, “ Skin Segmentation Using RGB Color Model and Implementation of Switching Conditions”,Vol. 3, Issue 1, January -February 2013, pp.1781-1787

[4]I.A.G. Boaventura, V.M. Volpe, I.N. da Silva, A. Gonzaga, “Fuzzy Classification of Human Skin Color in Color Images”, manuscript received March, 15, 2006.

[5]Shamir, L. Human perception-based color segmentation using fuzzy logic, International Conference on Image Processing, Computer Vision and PatternRecognition (IPCV 2006), vol. 2, pp. 496-505. Las Vegas, NV. 2006.

[6]Borji A. and Hamidi M. Evolving a fuzzy rule base for image segmentation, Proceedings of world academy of science, engineering and technology, vol. 22, July 2007, pp. 4-9.

[7]Dr. Shefa A. Dawwd, “Real Time Image Segmentation for Face Detection Based on Fuzzy Logic”, Computer Department, College of Engineering University of Mosul The 1stRegional Conference of Eng. Sci. NUCEJ Spatial ISSUE vol.11,No.2, 2008 pp 278-287.

[8]Didik Rudjito,“The Application of Fuzzy Logic to Traffic Assignment in Developing Countries”,Thesis submitted for the degree of Doctor of Philosophy of the University of London and for the Diploma of Imperial College, December 2006.

[9]S. N. Sivanandam, S. Sumathi and S. N. Deepa, “Introduction of Fuzzy Logic using MATLAB”.

[10]“Fuzzy Logic Fundamental”, 3.fm Page 61 Monday, March 26, 2001 10:18 AM

[11]“Properities of Membership Functions, Fuzzification, and defuzzification”, Chapter 4, Fuzzy Logic with Engineering Applications, Second Edition T. J. Ross  2004 John Wiley & Sons, Ltd ISBNs: 0-470-86074-X (HB); 0-470-86075-8 (PB)

1

All Rights Reserved © 2012 IJSETR