Copyright © 2013 IJECCE, All right reserved
Color Based Image Segmentation Using Fuzzy Logic
Ayush Sharma
Instrumentation and Control Engineering Amity School of Engineering and Technology,
Bijwasan New Delhi, India Email: [email protected]
Rachana Nagal
Department of Electronics and Communication Engineering Amity School of Engineering and Technology,
Bijwasan New Delhi, India Email: [email protected]
Abstract — This paper projects to perform Image segmentation. Segmentation of an image can be done in several ways. Here, pixel based or color based technique is used to fragment an image. The rule based fuzzy logic system is applied to the image to segment its parts based on the values of each of the pixel (RGB values). In this paper, firstly the features of fuzzy logic reasoning are explained. Then, a fuzzy inference system is designed by defining various fuzzy rules and fuzzy sets as necessary. Afterwards, an algorithm is developed to scan the image for its various color components categorizing its colors fundamentally. The idea is to input the image, scan it for various color components, and then provide this data to the FIS system to obtain a constant value output. This divides the image in color lots and hence segmenting it. The segmented images are then shown, along with their computational time.
Keywords —Image Segmentation, Fuzzy Logic, FIS.
I. I
NTRODUCTIONImage segmentation is the first step in image analysis and pattern recognition. It is a critical and essential component of image analysis and pattern recognition system. Image processing, computer vision, face recognition, medical imaging, digital libraries, image and video retrieval, etc [1]. It is a process of dividing an image into different regions such that each region is, but the union of any two adjacent regions is not, homogeneous.
Image segmentation methods fall into five categories: Pixel based segmentation [2], Region based segmentation [3], Edge based segmentation [4], [5], Edge and region Hybrid segmentation [6] and Clustering based segmentation [7], [8], [9], [10], [11], and monochrome segmentation. Color image segmentation using fuzzy classification is a pixel based segmentation method. A pixel is assigned a specific color by the fuzzy system. Our approach in designing such a fuzzy system is to study the HSV color space and try to manually develop a set of fuzzy rules. The image segmentation using colors is more preferred than gray color space because former method is perceptible by human eye and one can easily determine the difference in the resulting color segmented outputs clearly. Compared to gray scale, color provides information in addition to intensity. Color is useful or even necessary for pattern recognition and computer vision. Also the acquisition and processing hardware for color images have become more available and accessible to deal with the computational complexity caused by the high dimensional color space. Hence color image processing has become increasingly more practical.
Many approaches forselecting a color space have been devised. Selection of a color space is image dependent.
There are two critical issues for color image segmentation: what segmentation method should be utilized and, what color space should be adopted. The HSV color space has several advantages over other color spaces [12] [13]. It is based on human color perception, useful in some cases where the illumination level varies, (because hue is invariant to certain types of highlights shading, and shadows) and it can also be useful for separating objects with different colors. Therefore, in this paper, HSV color space is used to model the fuzzy logic system.
II. F
UZZYL
OGICM
ODELING ONHSV
C
OLORS
PACEThe fuzzy set theory has attracted more and more attention in the area of image processing. It provides us with a suitable tool which can represent the uncertainties arising in image segmentation and can model the cognitive activity of the human beings. Fuzzy operators, properties, mathematics and inference rules (IF_THEN rules) have found more and more applications in image segmentation [14]. Despite the computational cost, fuzzy approach perform as well as or better than their crisp counterparts. The more important advantage of a fuzzy methodology lies in that the fuzzy membership function provides a natural means to model the uncertainty in an image. Subsequently fuzzy segmentation results can be utilized in feature extraction and object recognition phases of image processing and computer vision. Fuzzy approach provides a promising means for color image segmentation.
The HSV color space is cylindrical, but usually represented as a cone or a hexagonal cone (hexcone) because this is the subset of the space with valid RGB values. H (hue) is the angle around the V-axis (center line of the hexcone). It increases in value as we move counter- clockwise in the cone (when looking down the V-axis from the top of the cone), with red at 0 degrees. The V (value) is the vertical axis pointing up in the picture, with V=1 at the top of the hexcone, containing the relatively bright colors. The S (saturation) is a ratio that ranges from 0 at the V-axis (the center line of the hexcone) to 1 on a side of the hexcone.
Copyright © 2013 IJECCE, All right reserved color. Value is similar to luminance except it also varies
the color saturation.
Fig.1. Hue, Saturation, Value hexcone color model [15]
Fuzzy set theory provides a mechanism to represent and manipulate uncertainty and ambiguity. In fuzzy subsets, each pixel in an image has a degree to which it belongs to a region or a boundary characterized by a membership value [14]. By doing so, we can avoid making a crisp decision earlier and keep the information through the higher processing levels as much as possible.
A. Fuzzy sets:
Fuzzy Logic is a logical system which is an extension of multi-valued logic. Fuzzy logic approach acts as an interface between human perception and machine based logic. The method suggested in this work is based on categorization of HSV color space with the help of fuzzy logic. Since the H, S and V are the three components of HSV color space, the fuzzy logic has three antecedent variables namely, Hue, Saturation, Value and one consequent variable which is color class ID. The domain of the variables Hue, Saturation and Value is the interval (0, 255). The same interval is used in this work. The domain of the consequent variable is discrete, and depends on the number of the predefined color classes [17]. Fig. 2 shows overall FIS structure of current model.
Fig.2. FIS Editor window
In the model presented in this paper there are 10 fuzzy sets for Hue, 5 fuzzy sets for Saturation and 4 fuzzy sets for Value [17]. The fuzzy sets of the antecedent fuzzy variable Hue are defined based on 10 basic hues distributed over the 0 – 255 spectrum. The hues are Red, Orange, Yellow, Green, Cyan, Blue, Purple, Magenta, and
Pink. Green and Blue are defined using trapezoidal shaped built-in membership functions whereas, rest are defined using triangular-shaped built-in membership functions. The individual ranges of these are as follows: 0-21 is taken as Red, 0-43 is takes as Orange, 21-85 is taken as yellow and so on as shown in Fig. 3. These are assumed ranges as per our specific requirements of output and can be manually defined in FIS editor of fuzzy toolbox. The point of maximum of each membership function is determined based on the visual color spectrum described in [18], normalized to the (0,255) interval. Saturation is defined using the five fuzzy sets Gray, Mostly Gray, Medium, Mostly Clear, and Clear as shown in Fig. 4. Value is defined using the four fuzzy sets Dark, Medium Dark, Medium Bright and Bright as described in Fig. 5.
Fig.3. Membership functions in Hue.
Fig.4. Membership functions in Saturation
Fig.5. Membership functions in Value
B. Fuzzy rules
Copyright © 2013 IJECCE, All right reserved is Magenta, the saturation is Mostly gray and the value is
Medium dark then result is Purple”.
The reasoning procedure is based on a zero-order Takagi- Sugeno model [19, 20], so that the consequent part of each fuzzy rule is a crisp discrete value of the set {Black, White, Red, Orange, Yellow, Pink, Dark Brown, Cyan, Blue, Light Green, and Purple}.Some of the fuzzy rules used in this model are:
Red Gray Dark ⇾ Black,
Red Mostly gray Medium dark ⇾ Dark Brown, Red Mostly clear Bright ⇾ Red,
Orange Clear Bright ⇾ Orange, Yellow Clear Bright ⇾ Yellow,
Green Medium Medium bright ⇾ Light Green, Blue Medium Medium bright ⇾ Cyan, Magenta Mostly gray Medium dark ⇾ Purple
Fig. 7 shows Rule Viewer which provides the information about the rules and various output results which could be generated by the resultant fuzzy structure. For example, when Hue = 58, Saturation = 94 and Value = 207 then Result equals 100 as indicated. The Surface Viewer (Fig.8) reflects the surface view according to the values of the input variables i.e. Hue, Saturation and Value.
Fig.6. Rule Editor
Fig.7. Rule viewer
Fig.8. Surface View between Hue and Saturation
III.
E
XPERIMENTS ANDR
ESULTSThe model presented here is designed and executed in MATLAB. Fuzzy toolbox is used for creating and editing of membership functions, fuzzy rules and sets. Experiments are performed on Intel i3 CPU at 2.13 GHz and 3GB of RAM.
Procedure followed is given below:
1. Fuzzy toolbox is opened by writing „fuzzy‟ in the command window.
2. Sugeno type model is selected as FIS type.
3. Three input variables are added (Hue, Saturation, and value).
4. Then, 10 membership functions for Hue, 5 for Saturation and 4 for Value are defined. Therefore, maximum number of rules can be [19]: 10*5*4 = 200. Membership functions are named as linguistic variables. 5. Range for all the membership functions is taken as (0,255). Range for output has to be 1 as defined by properties of fuzzy system.
6. Rules are defined as per user‟s requirements of extracting colors from an image. Here, they are chosen closer to human perception.
7. The fuzzy system is thus saved as .fis file.
Copyright © 2013 IJECCE, All right reserved Fig.9. RGB color space represented in a 3-dimensional
cube [16]
Table I: Computational Time Taken By Various Images of Various Sizes
Figure Name
Dimensions Size (KB) Elapsed Time (seconds)
Fig. A 580*320 43.5 192.91403
Fig. B 300*300 113 92.687772
Fig. C 650*450 206 281.78527
Fig. D 281*180 8.84 52.951982
Fig. E 300*300 32.4 93.810882
IV. C
ONCLUSIONIn this paper, fuzzy logic based method of color image segmentation was described. By using fuzzy logic, segmentation of image could be done on pixel basis. Each pixel value is processed and placed under a user predefined region (linguistic variables). Due to this, segmentation is not only limited to rectangular clusters or linear segments as in traditional segmentation techniques. From the Table I, it is evident that the computational time for each image scanned, increases with increase in number of rules. One of the disadvantages of using more rules is rule conflictions. Results also show that images with larger dimensions take more time to get segmented than an image with smaller dimensions. This model allows simple modifications as per the requirements of a specific application. The efficiency of algorithm is fairly good which allows it to be used in real life applications.
Fig. A
Fig. B
Fig. C
Fig. D
Copyright © 2013 IJECCE, All right reserved
R
EFERENCES[1] A. A. Younes, I. Truck and H.Akdaj, “Color Image Profiling Using Fuzzy Sets," Turk J Elec Engin, vol.13, no.3, 2005. [2] G. A. Ruz, P.A. Estevez, and C.A. Perez, "A Neurofuzzy Color
Image Segmentation Method for Wood Surface Defect Detection," Forest Prod. J, pp 52-58, 2005.
[3] A. Moghaddamzadeh and N. Bourbakis, "A Fuzzy Region Growing Approach for Segmentation of Color Images," Pattern Recognition, pp: 867-881, 1997.
[4] G.S. Robinson, "Color Edge Detection," Opt. Eng, pp 479- 484, 1977.
[5] J. Canny, "A Computational Approach to Edge Detection," IEEE Trans. Pattern Anal. Mach. Intell, pp 679-698, 1986.
[6] A. Shiji and N. Hamada, "Color Image segmentation Method Using Watershed Algorithm and Contour Information,” Proc. Inter. Conf on Image Processing, pp 305-309, 1999.
[7] B. Zhang, "Generalized K-harmonic Means-boosting in Unsupervised Learning," Technical report 2000.
[8] J. Bezdek, "A Convergence Theorem for the Fuzzy ISODATA Clustering Algorithms," IEEE Trans Pattern Anal Mach Intell,vol. 2,pp.1-8, 1980.
[9] G. Ball and D. Hall, "A Clustering Technique for Summarizing Multivariate Data"vol.12,pp:153-155, 1967.
[10] K. Huang, "A Synergistic Automatic Clustering Technique (Syneract) for Multispectral Image Analysis," Photogrammetric Eng Remote Sens, vol.1,pp 33-40, 2002.
[11] M.G.H. Omran, A. Salman, and A.P. Engelbrecht, "Dynamic Clustering Using Particle Swarm Optimization with Application in Image Segmentation," Pattern Anal Applic, vol 8,pp 332-344, 2005.
[12] P.W.M Tsang and W.H. Tsang, “Edge Detection on Object Color, IEEE International Conference on Image Processing, pp.1049-1052, 1996.
[13] E. Tepichin, J.G. Suarez-Romero and G. Ramirez, “Hue, Brightness, and Saturation Manipulation of diffractive colors Optical Engineering, Vol. 34, Oct. 1995.
[14] S. K. Pal et al, “A Review on Image Segmentation Techniques,” Pattern Recognition, pp 1277-1294, 1993.
[15] N. Herodotou, K.N. Plataniotis, .N.Venetsanopoulos “Automatic location and tracking of the facial region in color video sequences”, Signal Processing: Image Communication Volume 14, Issue 5 Pages 359–388, March 1999,
[16] D. E. P. Hoy, “On the Use of Color Imaging in Experimental Applications” Experimental Techniques, pp 17- 19, 1997. [17] L. A. Zadeh, “Fuzzy Sets,” Information and Control vol. 8,
pp338- 353,1965.
[18] H. S. Francis, Computer Graphics, Macmillan Pub. Co., 1990. [19] T. Takagi, M. Sugeno, “Derivation of Fuzzy Control Rules from
Human Operator‟s Control Actions,” in Proc. Of the IFAC Symp. on Fuzzy Information, Knowledge Representation and Decision Analysis, pp. 55–60, 1983.
[20] T. Takagi, M. Sugeno,“Fuzzy Identification of Systems and Its Applications to Modeling and Control,” IEEE Trans. Syst. Man & Cybern. 20, pp. 116– 132, 1985.
A
UTHOR’
SP
ROFILE
Ayush Sharma
is a B.Tech. in Instrumentation and Control Engineering from Guru Gobind Singh Indraprastha University, New Delhi. He graduated in 2013 and his interests include Image Processing, Robotics, and Networking.
Ms. Rachana Nagal
received M.Tech. degree in Instrumentation from Panjab University in the year 2007. M.Sc. degree in Electronics from Devi Ahilya University, Indore, in 2004. B.Sc. degree in Electronics from Rani Durgawati University, Jabalpur, in 1999. In 2007, she joined the Deptt. of Electronics and communication engineering, Amity School of engineering and technology, New Delhi as a Lecturer and presently working as Assistant Professor here. Her interests include, Digital Signal Processing, Digital Image Processing. She has contributed over 10 technical papers in various conferences.