Recognition Of Skin Using Fuzzy Logic Approach Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

This Report is based on the RGB colour space, using fuzzy sets instead of traditional colour spaces; thus, input colour variables are fuzzified and, as a result, a pixel is classified after the defuzzifying process is completed. To do this, we will revise some skin colour detection algorithms and then the designing of the fuzzy system for detecting skin is described. After that, the experiments are outlined and discussed, the system is tested and, finally, we shall conclude with some remarks to our work in. Skin and non-skin training dataset has been given by using various skin textures obtained from images of diversity of age, gender, and race people.


There are many approaches to skin detection, such as knowledge- and appearance-based methods, feature invariant algorithms or template matching techniques. In this work, we shall focus on a pre-processing stage for detecting faces in colour images. To do this, we assume that the problem consists of detecting skin regions in the image, and then the segmented skin clusters will be further processed to validate they belong to face regions.

Many recent proposals are based on the underlying idea of representing the skin colour in an optimal colour space (such as RGB, YIQ or HSV) by means of the so-called skin cluster. Colour information is an efficient tool for identifying facial areas if the skin colour model can be properly adapted for different lighting environments. This fact leads to avoid the use of RGB in practical systems, since the red, green and blue components are highly correlated and dependent on lighting conditions(Vijayanandh,2011). However, the RGB space corresponds most closely with the physical sensors for colored light such as the cones in the human eye or red, green and blue filters in most colour CCD sensors. In addition, using a RGB model should simplify the design of any algorithm, since there is no need to transform the colour spaces.

According to a research help by Arshdeep Kaur and Amrit Kaur, "fuzzy systems are very useful in two general contexts: 1)in situations involving highly complex systems whose behaviors are not well understood, and 2) in situations where an approximate, but fast, solution is warranted" (Kaur & Kaur, 2012).

Main Part

Fuzzy Classification

Image segmentation using fuzzy classification is a pixel-based segmentation method. This method assigns a colour class to each pixel of an input image by applying a set of fuzzy rules on it. A pixel can be classified as 'skin' or 'non-skin' according to a set of fuzzy rules extracted from a training stage using different colour spaces. To do this, each colour plane will be considered as a fuzzy set, so that the skin detection is performed through fuzzy functions representing the membership degree of each pixel to the different classes.

A method to develop a skin classifier consists of defining the bounding limits of the regions corresponding to a colour which belongs to the skin, by means of some numerical (and often empirical) rules, i.e., defining explicitly the skin regions.

Fuzzy Decision Trees

The most important feature of decision trees is their capability to break down a complex decision-making process into a collection of simpler decisions and thereby, providing an easily interpretable solution. ID3 is a popular and efficient method of decision-making for classification of symbolic data and is generally not suitable in cases where numerical values are to be operated upon.

The fusion of fuzzy sets with decision trees enables one to combine the uncertainty handling and approximate reasoning capabilities of the former with the comprehensibility and ease of application of the latter.

Fuzzy decision trees are composed of a set of internal nodes representing variables used in the solution of a classification problem, a set of branches representing fuzzy sets of corresponding node variables, and a set of leaf nodes representing the degree of certainty with which each class has been approximated.

Fuzzy Inference System

A fuzzy inference system is widely used for process simulation or control and it consists of 4 steps:

Fuzzification of the input variables

Rule evaluation

Aggregation of the rule outputs


Fuzzification is the process where crisp inputs are translated to fuzzy values. According to the fuzzy values that were obtained, rules must be created in order to connect the input/inputs with the outputs. The aggregation is done when the membership functions of all rule consequents previously clipped or scaled are combined into a single fuzzy set. Defuzzification is the opposite process of the fuzzification where the fuzzy outputs are translated to crisp values.

Methods: There are three types of fuzzy inference

Mamdani fuzzy inference

Sugeno fuzzy inference

Tsukamoto fuzzy inference

For simplicity reasons only the two most known (Mamdani and Sugeno) types will be discussed here. Even though both use the same processes for fuzzification and the evaluation of the rules, they differ at aggregation of the rules and at the process of defuzzification. While Mamdani's F works in a more human-like manner, Sugeno method is used for more efficient computations and works better with optimisation. Thus it makes it more attractive to be used in control problems, especially for non-linear systems (Kaur, 2012).

Experimental Results and Analysis

Decision Tree:

After loading the data given at the coursework the next step is to create a decision tree to map the data into categories. By using the command classregtree a decision tree is created for predicting the response based on the first three columns of the data file. By default the pruning level was 148. With the command prune and given the level 142 (which is the result from the 148 default prunes minus the number of the nodes we need) the decision tree is similar to figure

Level 142 was chosen so that the ending nodes will be as close to 1 or 2 as possible.

The FIS:

Based on the decision tree the next step is to do the fuzzification. According to this the results for the Red, Blue and Green functions are shown in the figures 2,3,4.

Figure - Red

Figure - Blue

Figure - Green

Fuzzy Logic Toolbox

There is a toolbox in Matlab that allows to create membership functions. Using the Fuzzy Logic Toolbox the functions for Red, Blue and Green are created as well as the output functions. The method used for this is the Mamdani method.

Figure - Membership Functions


At that point, according to the functions and the decision tree, the rules can be created.

These are:

IF (X3= R1) OR (X3=R2) AND (X1= B2) OR (X1=B3) THEN Y=NONSKIN



IF (X2=G1) OR (X2=G2) AND (X3=R2) OR (X3=R4) THEN Y=NONSKIN

IF (X2=G3) AND (X1=B3) AND (X3=R3) OR (X3=R4) THEN Y=NONSKIN



IF (X1=B1) AND (X2=G2) OR (X2=G3) OR (X2=G4) OR (X3=G5) AND (X3=R2) THEN Y=SKIN

IF (X1=B1) OR (X1=B2) AND (X2=G3) AND (X3=R3) OR (X3=R4) THEN Y=SKIN


Results and Testing

The next step after creating the rules was to start using the software. That could be either done manually by changing the values of R,B,G in the tab Rules of the Fuzzy toolbox either by writing a code in the Main coursework. In order to perform fuzzy inference calculations, the function evalfis is used. Evalfis gets an input or a matrix of inputs and gives the output by using the existing fis. In this project the input was the test data and the output would be a number 1 or 2. One would mean that the colour given is a Skin while 2 referred to Non- Skin pixels.


Face detection is object of intensive research in the last few years and this tendency is increasing, since it is the initial and, perhaps, the critical process for an integral face recognition system. One of the methods used for detect a face is to use a skin segmentation scheme, which has been proved to be highly effective in many applications.

In this report, a fuzzy skin colour detector using the RGB colour space has been used. Each colour plane has been modeled using different fuzzy sets for the skin and non-skin classes and the inference system and defuzzifying process have been exposed.

Bibliography and Citations

Arshdeep Kaur, Amrit Kaur, (2012),Comparison of Mamdani-Type and Sugeno-Type Fuzzy Inference Systems for Air Conditioning System[pdf], Available at: [Accessed: 20 Nov 2012]

Binoy's Tech Blog, (2007), Fuzzification and Defuzzification, Available at:,

[Accessed: 15 Nov 2012]

Institutional Repository of the University of Alicante,2008, A Fuzzy Approach to Skin Color Detection[pdf] Available at: [Accessed: 17 Nov 2012]


R. Vijayanandh and Dr. G. Balakrishnan,(2011), A Hybrid Particle Swarm Optimization Algorithm to Human Skin Region Detection[pdf],Available at: [Accessed: 15 Nov 2012]

S. Mitra,(2003), Fuzzy decision tree, linguistic rules and fuzzy knowledge-based network: generation and evaluation, Available at:

Yang, M. H., Kriegman, D. J., Ahuja, N. (2002), Detecting faces in images: A survey, IEEE Transactions on Pattern Analysis and Machine Intelligence, 24(1), pp. 34-58