09.color Based Image Segmentation Using Adaptive Thresholding
09.color Based Image Segmentation Using Adaptive Thresholding
ISSN: 2454-1532
Abstract—The segmentation of the image furnishes the foundation for further operations in image processing like object recognition, color
recognition, object tracking, depth observation, etc. Adaptive thresholding, which is based on inter-pixel’s intensity relationship of the
image, is an efficacious method for carving out the required part or region of the image. An experimental analysis for implementing adaptive
thresholding has been carried out to understand the working of adaptive threshold values on the segmentation results. RGB and HSV color
models along with morphological operations are integrated with thresholding for better threshold values and better and smooth coverage of
the selected color region in the segmented results. Comparisons of adaptive thresholding with global thresholding based segmentation and
impact of various color models with thresholding has been made towards the end.
Keywords— Adaptive thresholding, RGB thresholding, HSV thresholding, color segmentation, color detection.
thresholding is inefficient [8]. In multispectral images also, the
I. INTRODUCTION global threshold does not produce any results [9].
I mage segmentation is a procedure of splitting the Other type of thresholding is adaptive thresholding, in
image into non-overlapping homogenous regions on which different threshold values are selected dynamically over
the basis of selected property of the image. Some of the image. It overcomes the limitations posed by global
such properties of image are its color tint, color intensity, thresholding to a great extent. For example, in [9] the
texture, depth of object, motion, etc. The results obtained by Niblack’s and Sauvola’s algorithms which are adaptive
segmentation basing these properties are different from one thresholding techniques produce better results than global
another. As per the objective of the study, appropriate property thresholding. In [10] limitations of global thresholding are
is chosen and is adhered for the segmentation procedure. presented along with the comparison of various adaptive
There are numerous techniques that can be used to segment threshold techniques. Some of the other major areas where
the image like edge detection, thresholding, region growing, adaptive thresholding technique is applied are - document
clustering, artificial neural network, region splitting and image binarization for its analysis [11], where authors have
merging, etc. [1][2]. Techniques like distance measuring improved Niblack’s method for adaptive thresholding by
techniques are also used for segmentation [3]. Among preventing its limitations like inability to adapt to high
segmentation techniques, thresholding is the most simple and illumination variation and providing unnecessary details in
versatile technique that decides for each pixel value of the output by finding the appropriate element that controls the
image that whether it belongs to region of interest or not. standard deviation at run-time; color image segmentation, for
Thresholding can be utilized in applications like extracting out example in skin color segmentation using dynamic
the objects from video using background subtraction [4]; eye thresholding [12], where with the help of eye detection
glint detection, where threshold parameters are utilized for technique individual thresholds are obtained for each person in
edge detection [5], [6]. the image; color segmentation with other technologies, for
The two major types of thresholding are global instance in [13] and [14] watershed algorithm is integrated
thresholding and adaptive thresholding. In global thresholding, with adaptive thresholding for segmentation and in [15] neural
a single threshold value is selected for the entire image. In this networks are used alongside adaptive thresholding, etc.
technique the pixels are partitioned depending on their There is enormous variety of applications of the image
intensity value f(x, y). Using the threshold T, the output binary segmentation, particularly of the colored ones in the digital
image is given by g(x, y) in Eq.1: world today. One of the significant applications is the
g(x,y) = 1,if f(x,y)>T; detection and segmentation of the specific color from the
0, if f(x, y) ≤T. (1) multiband images. In colored images there is an often a need
of studying and analyzing specific part(s) of it. These parts
Application of global thresholding includes image may be of different shape, color, texture, depth, etc. as the aim
binarization of image, for example the binarization is carried of the study requires. Using segmentation such parts of
out by iterative partitioning of image in [7]. Global interest can be extracted out of the image. Such type of
thresholding perform fairly well when the pixel values of the segmentation can be used in the color based information
components in the foreground and the background of image retrieval system [16] [17]; color based object identification
are coherent with respect to the entire image. When the image [18]; color based object tracking [19][20]; color identification
has low contrast and poorly illuminated then the global for visually disabled people [21]. As discussed earlier,
151
Parul Sharma and Pawanesh Abrol, “Color based image segmentation using adaptive Thresholding,” International Journal of Scientific and
Technical Advancements, Volume 2, Issue 3, pp. 151-156, 2016.
International Journal of Scientific and Technical Advancements
ISSN: 2454-1532
thresholding can be very efficiently applied on such multiband result obtained with global thresholding. In [26], the
or colored images as well to segment out the region needed for authors divide the image into array of overlapping sub-
the further processing. Besides thresholding in colored image blocks and study their histograms to generate
images, significant properties of various color models like threshold values.
RGB, HSV, HSI, YUV, etc. can be employed for image Statistically studying the neighborhood: In this case, each
segmentation. RGB image taken as input is converted into pixel of the image is checked against threshold obtained
improved HSI (IHSI) color space for the color segmentation of by statistically examining the neighborhood pixel of each
traffic sign boards by using the information provided by the pixel. In [9] author has compared such type of adaptive
IHSI model [22]. HSV model can be used to segment the thresholding with Otsu’s global thresholding and iterative
colored image by the clustering method in which the similar thresholding. Similar type of thresholding filters is used in
pixels are grouped into a same regions. This is achievable by [27] to remove noise from the image.
computing the appropriate saturation and value information of Component based threshold selection: Adaptive nature of
the pixels of the image [23]. thresholding is exploited by selecting different threshold
In this paper, standard global thresholding technique-Otsu values for different components of image. For example, in
thresholding, which statistically and heuristically evaluates the [12] authors have used different threshold values for skin
threshold value for the image, has been used. This technique detection in different persons by selecting the threshold
categorizes each pixel of the image into two classes, which value from the face skin of the person. The dynamic
are- foreground and background. It aimed at finding the threshold is generated by two sided confidence level
minimum intra-class variance and maximum inter-class interval of 95% for normal distribution N(µ, σ²), where µ,
variance as shown Eq.2 and Eq.3 respectively. σ² are mean and standard deviation of array of smooth
σ²w(t)=w0(t) σ²0(t) + w0(t) σ²0(t) (2) region respectively.
σ²b(t)= w0(t) w1(t)[µ0(t)- µ1(t)]2 (3) Thresholding along with other technologies: Technologies
Where, σ²w is the intra-variance of a class, w0,1 is the class like watershed algorithm, fuzzy logic, neural network, etc.
probability, σ²b is the inter-class variance and µ0,1 is the class when used in combination with the thresholding
mean [24]. The technique can be applied on each band (red, techniques gives new aspect to the research in image
green, blue) of RGB image for three respective threshold segmentation. For example, in [13] thresholding selection
values. Using this utility of Otsu technique, a very efficient is used in watershed algorithm to prevent its problem of
and robust color detection and segmentation scheme is over-segmentation. Use of neural network alongside of
presented in this paper. thresholding in [15] provides number of objects
automatically in the image which enables the labeling of
II. ADAPTIVE THRESHOLDING
objects without the prior knowledge of the image.
Adaptive or local or dynamic thresholding is a technique
of finding the different threshold values for different regions III. OBJECTIVES
of the image. As discussed above, thresholding is a significant technique
Though the threshold values selected for each band of for carrying out segmentation of binary as well as multiband
RGB image with Otsu technique are reliable but sometimes or colored images. Keeping this into consideration, following
when the intensity of the image or the saturation of color in objectives are set for the study-
the image varies throughout the image, the result obtained by To understand different thresholding techniques in
mere single threshold value cannot bring the accurate results relation to image segmentation.
for the image. Therefore, there is a need of selecting multiple To apply adaptive thresholding on the colored image for
threshold values for different regions of the image and hence, the red, green and blue color based image segmentation.
we use adaptive thresholding. There are many ways to To exploit the properties of color models like RGB (Red
implement the adaptive technique, some of which are given in Green Blue) and HSV (Hue Saturation Model) for
following subsection. efficient color segmentation.
A. Adaptive Thresholding Approaches Comparing the results obtained by adaptive form with
There are various techniques by which adaptive form of global form of thresholding.
thresholding selection can be utilized, but the aim of all the Comparing the results obtained by segmentation using
ways is to find the appropriate threshold for different regions RGB and both RGB and HSV color models along with
in the image. Some of the techniques are given below: thresholding.
Dividing the image into n x m blocks: In this case, the IV. PROPOSED WORK
image is divided into n x m blocks, overlapping or non-
overlapping as the objective desires, where {n, m ∈ N| n, The following section describes the proposed work for
m > 0}. Then global thresholding is applied on each block implementing adaptive thresholding on multiband or colored
which provides varying thresholds for each block. For images for color based segmentation. In the work, properties
example in [25], the authors have executed adaptive of RGB and HSV color models are utilized along with
thresholding using this procedure and have compared the adaptive thresholding for better color segmentation.
152
Parul Sharma and Pawanesh Abrol, “Color based image segmentation using adaptive Thresholding,” International Journal of Scientific and
Technical Advancements, Volume 2, Issue 3, pp. 151-156, 2016.
International Journal of Scientific and Technical Advancements
ISSN: 2454-1532
As discussed in section II-A, RGB image is taken as input extracted and Otsu thresholding technique is applied on both
and then is divided into n x m sub-images blocks, where each of them. Thresholding the Value prevents the selection of very
block is processed separately to prepare a mask, which is dark to black region and thresholding the Saturation prevents
applied towards the end to extract out the region of interest. the selection of very light to white region if not needed.
Individual mask is applied on the blocks and the resulting
blocks are again combined to form the desired output image. E. Morphological operations
Following subsection A to F gives the description of important Morphological operations are applied on the structure or
processes taken out for color based segmentation followed by shape of the image to alter it in the desired manner. In this
the flowchart in figure 1. proposed work the operations like closing(), fill(),
bwareaopen() are used. The final mask is prepared by
A. Image into n x m blocks incorporating these operations. These operations assist in
The input colored image is divided into n x m sub-images producing more smooth and clean segmentation. The prepared
blocks, where {n, m ∈ N| n, m > 0 and n, m<7}. Here, values mask is applied separately on each block to segment the
desired color.
for n and m are kept small because further higher for them will
give the stagnant results. Otsu’s global thresholding [18] is F. Combine the image blocks
applied on each sub-image blocks separately to obtain more In the last step all the masked blocks are recombined to
appropriate threshold values for it. Each block in such a way form the color based segmented image of the original image.
has its own threshold values which make the thresholding
procedure adaptive in nature. The transformation of image into
n x m blocks is given in Eq.1.
Block = mat2cell (Image, R, C, b) (1)
Where, R and C are the number of blocks in a row and
column respectively. In further steps B to F mask is prepared,
which will be applied on each of these blocks towards the end.
B. RGB Thresholding using Otsu
The RGB bands of the input colored image are extracted
out and the Otsu thresholding technique is applied on each of
the band individually. The histogram obtained for red, green
and blue bands correspond to respective pixel’s color intensity
distribution of the image.
C. Thresholded RGB to Hue conversion
In this step, the characteristics of the HSV (Hue,
Saturation, and Value) color space are utilized by working on
Hue value. The hue has the benefit of better covering of the
intensity and saturation variance in the image than the RGB
thresholding. The conversion formula RGB to the Hue is
given in Eq. 4.
Fig. 1. Proposed methodology.
Undefined, if C=0;
H= mod6 if M=R; V. RESULTS AND DISCUSSIONS
The proposed methodology has been applied to different
+2 if M=G; colored images ranging from images with medium to high
brightness, computer generated images, natural images,
+4 if M=B; (4) remote images, etc. One such colored image is segmented
using above mentioned proposed methodology, whose
segmentation results are shown in figure 2.
Where, C=M-m; M=max(R, G, B) and m=min(R, G, B) A. Comparison with Global techniques
and R, G, B are the computed values for red, green and blue As discussed in section II, global thresholding has the
from the respective threshold values obtained from step- B. limitations when there is a high variation in the brightness of
This is a crucial step as the computed Hue value ensures the
the image. Using thresholding adaptively throughout the
segmentation of a selected color more expeditiously than alone
RGB threshold value had done. image overcomes these shortcomings and brings out the better
results. In figure 3 the comparison has been done for the
D. Saturation and value thresholding segmentation result of remote image of the earth obtained by
The RGB image is converted into HSV image format using applying adaptive thresholding technique to global
standard Matlab code. The Saturation and the Value bands are thresholding technique.
153
Parul Sharma and Pawanesh Abrol, “Color based image segmentation using adaptive Thresholding,” International Journal of Scientific and
Technical Advancements, Volume 2, Issue 3, pp. 151-156, 2016.
International Journal of Scientific and Technical Advancements
ISSN: 2454-1532
(b)
(c)
Fig. 2. Red, green and blue based adaptive threshold segmentation shown in
(a), (b) and (c) respectively.
154
Parul Sharma and Pawanesh Abrol, “Color based image segmentation using adaptive Thresholding,” International Journal of Scientific and
Technical Advancements, Volume 2, Issue 3, pp. 151-156, 2016.
International Journal of Scientific and Technical Advancements
ISSN: 2454-1532
REFERENCES
[1] S. Agrawal and D. Kumar Xaxa, “Survey on image segmentation
Some unwanted
No green region is techniques and color models,” International Journal of Computer
green region is also
segmented. Science & Information Technology, 2014, Vol. 5(3), Issue 3, pp. 3025-
segmented.
3030.
[2] N. M. Zaitoun and M. J. Aqel, “survey on image segmentation
techniques citation,” Elsevier, International Conference On
Communications, Management And Information Technology, 2015, Vol.
65, Pages 797-806.
Unwanted red color No unwanted red [3] Hempriya Bali and Pawanesh Abrol, “Estimating the similairty of the
is also segmented color is segmented Objects Using Feature Vectors,” Internationl Journal of Modern
out in result. out in result. Computer Science, 2016,(accepted)
[4] Rudrika Kalsotra and Pawanesh Abrol, “Threshold-based moving object
extraction in video streams,” International Journal of Scientific and
Technical Advancements, vol. 2, issue 2, 2016, (unpublished).
[5] Anjana Sharma and Pawanesh Abrol, “Comparative analysis of edge
Unwanted colors Only blue color is detection operators for better glint detection,” in IEEE 2nd International
other than blue are segmented out in Conference on Computing for Sustainable Global Development
segmented out results (INDIACom), pp. 973-977, 2015.
[6] Anjana Sharma and Pawanesh Abrol, “Glint detection and evaluation
using edge detectors,” International Journal of Scientific and Technical
Advancements, vol. 1, issue 3, pp. 319-323, 2015.
[7] Soharab Hossain Shaikh, Asis MaitI and Nabendu Chaki, “ Image
binarization using iterative partitioning: a global thresholding approach,”
IEEE, Recent Trends in Information Systems, International Conference,
Unwanted white Kolkata, pp. 281-286, 2011.
Less white color is
color is also [8] Hafizan Mat Som, Jasni Mohamad Zain and Amzari Jihadi Ghazali,
segmented out in
segmented out in “Application of Threshold Techniques for Readability Improvement of
result.
result. Jawi Historical Manuscript Images,” Advanced Computing: An
International Journal, March 2011, Vol.2, No.2, pp. 60-69
[9] Hari Kumar Singh, Shiv Kumar Tomar and Prashant Kumar Maurya,
“Thresholding techniques applied for segmentation of RGB and
multispectral images,” International Journal of Computer Applications
proceedings on National Conference on Advancement in Electronics and
Telecommunication Engineering, 2012, pp. 24-27.
[10] Payel Roy, Saurab Dutta, Nilanjan Dey, Goutami Dey, Sayan
Chakraborty and Ruben Ray, “Adaptive thresholding: A comparative
study,” IEEE conference on Control, Instrumentation, Communication
and Computational Technologies (ICCICCT), Kanyakumari, pp. 1182-
1186, 2014.
(a) (b) (c) [11] N. B. Rais, M. S. Hanif and I. A. Taj, “Adaptive thresholding technique
for document image analysis,” IEEE Multitopic Conference,
proceedings of INMIC, pp. 61-66, 2004.
[12] Pratheepan Yogarajah, Joan Condell, Kevin Curran, Abbas Cheddad and
Paul McKevitt, “A dynamic threshold approach for skin segmentation in
color images,” IEEE International Conference on Image Processing,
Hong Kong, 2010, pp. 2225-2228.
[13] Md. Habibur Rahman and Md. Rafiqul Islam, “Segmentation of color
image using adaptive thresholding and masking with watershed
(d) (e) (f) algorithm,” IEEE Informatics, Electronics & Vision (ICIEV), Dhaka,
Figure 4: Original image (a) and (d); (b), (e) and (c), (f) shows the green and 2013, pp. pp. 1-6.
blue segmented images respectively using RGB model only (upper row) and [14] Ety Navon, Ofer Miller and Amir Averbuch, “Color image segmentation
both RGB and HSV model (lower row). based on adaptive local thresholds,” Elsevier, Image and Vision
Computing, 23(1), pp.69-85, 2005.
[15] K. S. Deshmukh and G. N.Shinde, “An Adaptive Color Image
VI. CONCLUSION Segmentation,” Electronic Letters on Computer Vision and Image
A fresh method for color detection and segmentation of Analysis, pp. 12-23, 2005.
colored images using adaptive thresholding is suggested in [16] “Color Segmentation and Object Identification using a Naive Bayes
Classifier and Gaussian Mixture Models,” Teyvoniathomas.com, 2016.
this paper. The primary colors- red, green and blue are [Online]. Available: http://teyvoniathomas.com/index.php/projects/62-
extracted out more cleanly by using properties of color models color-seg-gnb.html
like RGB and HSV integrated with adaptive thresholding. The [17] Weigen Huang and Xiulin Lou, “Satellite remote sensing for red tide
proposed segmentation process is robust to variety of image detection and monitoring in China,” Society of Photographic
Instrumentation Engineers (SPIE), The International Society for Optical
samples. Limitations of Global thresholding method and RGB Engineering, vol. 4892, May 2003.
model based thresholding are also are outlined in this paper. [18] Theo Gevers and Arnold W.M. Smeulders, “Color-based object
This technique can be further extended to work for more recognition,” ELSEVIER, Pattern Recognition, vol. 32, issue 3, march
regular colors. 1999, pp. 453-464.
[19] Tang Sze Ling, Liang Kim Meng, Lim Mei Kuan, Zulaikha Kadim and
Ahmed A. Baha'a Al-Deen, “Colour-based object tracking in
surveillance application,” International MultiConference of Engineers
155
Parul Sharma and Pawanesh Abrol, “Color based image segmentation using adaptive Thresholding,” International Journal of Scientific and
Technical Advancements, Volume 2, Issue 3, pp. 151-156, 2016.
International Journal of Scientific and Technical Advancements
ISSN: 2454-1532
and Computer Scientists Proceedings of the International [24] Nobuyuki Otsu, “A Threshold Selection Method from Gray-Level
MultiConference of Engineers and Computer Scientists, vol. I, Hong Histograms,” IEEE Transactions on Systems, Man, and Cybernetics, vol.
Kong, March 2009. 9, no. 1, pp. 62-66, 1979.
[20] T. D. Grove, K. D. Baker and T. N. Tan, “Colour based object tracking,” [25] Ashutosh Kumar Chaubey, “Comparison of the Local and Global
IEEE Proceedings, Fourteenth International Conference, Pattern Thresholding Methods in Image Segmentation,” World Journal of
Recognition, Australia, vol. 2, pp.1442-1444, 1998. Research and Review, vol. 2, issue 1, pp. 01-04, 2016.
[21] Sara A. Al-Doweesh, Felwah A. Al-Hamed and Hend S. Al-Khalifa, [26] C. K. Chow and T. Kaneko, “Automatic boundary detection of the left
“What Color? A Real-time Color Identification Mobile Application for ventricle from Cineangiograms,” Elsevier, Computers and Biomedical
Visually Impaired People,” Springer, Communications in Computer and Research, vol. 5, issue 4, pp. 388-410, August 1972.
Information Science, vol. 435, pp. 203-208, 2014. [27] S. Priyanka and Dr. A. S. Naveen kumar, “Noise Removal in Remote
[22] Hasan Fleyeh, “Color detection and segmentation for road and traffic Sensing Image Using Kalman Filter Algorithm,” International Journal
signs,” IEEE conference on Cybernetics and Intelligent Systems, of Advanced Research in Computer and Communication Engineering,
Singapore, pp. 809-814, 2004. vol. 5, issue 3, pp.894-897, march 2016.
[23] S. Sural, Gang Qian and S. Pramanik, “Segmentation and histogram
generation using the HSV color space for image retrieval,” IEEE
proceedings on Image Processing, vol. 2, pp. II-589-II-592, 2002.
156
Parul Sharma and Pawanesh Abrol, “Color based image segmentation using adaptive Thresholding,” International Journal of Scientific and
Technical Advancements, Volume 2, Issue 3, pp. 151-156, 2016.