Comparative Study on Threshold Techniques for Image Analysis

DOI : 10.17577/IJERTV4IS060563

Download Full-Text PDF Cite this Publication

Text Only Version

Comparative Study on Threshold Techniques for Image Analysis

Saloni Khurana

Student of ECE, UPTU University Sachdeva Institute of Technology, Mathura

Abstract – Image thresholding is the method of converting a gray scale image into binary image. It is useful in discriminating foreground from background. The best possible binary image can be obtained by selecting an adequate threshold value. This paper is based on partitioning an image into regions that are similar according to predefined criteria. Here, objective is to apply various thresholding techniques on different images and find the best suitable technique for generating binary image. All the input images are gray scale images .


Keywords – Binary image, Grey Scale image, Image Threshold


    In many applications of image processing, the gray levels of pixels belonging to the object are different from the gray levels of the pixels belonging to the background, thresholding then become a simple but effective tool to separate objects from the background. Image segmentation is the process in which image is divided into homogeneous regions. Image segmentation is typically used to locate lines, curves, etc. in images. Each pixel in the image is similar with respect to some property (color, intensity, texture etc). Image Segmentation algorithms are defined on the basis of one of the two properties intensity values discontinuity and similarity. First, is to partition an image based on abrupt changes in intensity, such as edges in an image. Second category is based on partitioning an image into regions that are similar according to predefined criteria. Histogram Threshold approach falls under this category

    A wide range of image segmentation algorithms have appeared in the literature. However, a popular technique in image segmentation is thresholding, which is computationally simpler than other existing algorithms, such as boundary detection or region-dependent techniques. Thus, if a computational requirement is of important consideration, as in

    machine vision, the thresholding technique is preferred to other techniques and is a widely used for image segmentation.

    The main objective of this study is to review various thresholding based technique that has been used for segmenting the image and further generating the binary image from a gray scale image. The quality of the generated binary image depends upon the selection of the

    value of threshold chosen. Thus, the value becomes the key factor for success of this method.

    Threshold segmentation techniques can be grouped in three different categories:

    1. Local techniques are based on the local properties of the pixels and their neighborhoods.

    2. Global techniques segment an image on the basis of information obtain globally (e.g. by using image histogram; global texture properties)

    3. Split, merge and growing techniques use both the notions of homogeneity and geometrical proximity in order to obtain good segmentation results.

    Threshold techniques can be broadly categorized into two categories namely global threshold and local (adaptive) threshold. In the former approach, a single threshold value is selected and is applied in the entire image whereas in the latter approach, each pixel is assigned a different threshold value as to determine whether it belongs to the object or the background pixel using local information around the pixel. Let N represents the set of natural numbers, the spatial coordinate of a digitized image be represented (x, y), and set of positive integers corresponding to gray levels, G = (0, 1, . . . , I – 1). Then, the mapping f : N x N G defines the image function. Therefore, the brightness of a pixel having coordinate (x, y) will be given by f(x, y).

    Let threshold th G and a pair of binary gray levels BGL =

    {b0, b1} and b0, b1 G. The result of thresholding an image function f(x, y) at gray level th is a binary image function fth: N x N B, such that,

    bo if f(x, y) < th

    fth(x, y) =

    b1 if f(x.y) th


    The various thresholding algorithm discussed in this paper are Mean thresholding , Histogram thresholding , Variable thresholding, Edge thresholding , P- Tile thresholding.

    Mean thresholding:

    In this technique mean value of the pixels is calculated and is used as the threshold value. It is best in the case of the image that has approximately half the pixels belonging to the objects and the other half to the background but such images having both foreground and background in equal propionate rarely happens.

    In mean thresholding technique, the value of threshold (T ) can be calculated by finding average value of pixels.

    T = sum of pixel value/no. of pixels.

    Histogram thresholding:

    The histogram thresholding techniques are best suitable for images having separate objects and background. By selecting an appropriate threshold value the objects can easily be separated from the background. Considering any point (x,y) for which, image f(x,y) > th is called an object otherwise background.

    In this mid-point method is used to calculate the value of threshold.

    1. An initial threshold value th is determined.

    2. Two different mean values are calculated for below (m1) and above (m2).

    3. The new threshold value tp is calculated by taking the mean of m1 and m2 i.e. tp = (m1 + m2) / 2.

    4. If the threshold is stabilized (th = tp), then this would indicate that the new threshold level is this one. Else wise, th would become tp and it would also reiterate from step2.

    Variable thresholding:

    When different threshold values for different regions of an image are used it is known as variable thresholding. Variable thresholding is also known as local or dynamic thresholding. The methods such as pre-processing are ineffective in improving the accuracy of thresholding. Therefore, variable thresholding technique can be used on gray level images which do not have a clear distinction between object and background. Threshold values are varied in accordance to local image regions. One of the simplest approaches is Image Partitioning in which an image is subdivided into non-overlapping rectangles (areas). The rectangle area is choosen to be small so for that illumination may be uniform. Variable thresholding divides the image into rectangles, each one thresholded by a threshold value depending on the rectangles content that the threshold value adapts. The threshold value of a

    rectangle is chosen to be a weighted sum of the mean intensity value of the rectangle and a global threshold value.

    In this method image is partitioned in various rectangles of equal sizes than thresholding is done on the rectangle images separately and then these threshold parts are again combined.

    To do parts row wise:

    p1= I (1:32, 1:256) 2.1

    For column wise:

    p1=I (1:256, 1:32) 2.2

    Edge thresholding:

    In edge thresholding method, boundaries of an object are detected. Edges in an image contain the important information and also provide objects location. Edge points have different intensities than the neighborhood pixels. Edge points are formed at the points where intensity changes. Edge detection filters out useless information from an image and preserves its important structural properties.

    The Canny edge detector is known to many as the standard edge detection algorithm. It was first created by John Canny in 1986. His ideas and methods can be found in his report, "A Comutational Approach to Edge Detection". In the method, a list of criteria is followed so that edge detection could be better. The first criterion is low error rate. It is important that edges occurring in images should be detected and no responses to non-edges. The second criterion is that the edge points are well localized i.e. the distance between the edge pixels as found by the detector and the actual edge is to be at a minimum. The third criterion is to have only one response to a single edge. This was implemented because the first 2 were not substantial enough to completely eliminate the possibility of multiple responses to an edge.

    Based on above three criteria, the Canny edge detector first smoothes the image and eliminates the noise contents and then finds the image gradient to highlight regions with high spatial derivatives. The algorithm then tracks along these regions and non-maximum suppression is done. Furthermore hysteresis is used to reduce gradient array which tracks along the remaining unsuppressed pixels.

    Hysteresis uses two thresholds values. If the magnitude lying below the first threshold non-edge is made, if it is above the second threshold, an edge is made. And if the magnitude is between the 2 thresholds, then it is set to zero unless there is a path from this pixel to a pixel with a gradient above T2.

    Edge thresholding is a method in which we detect the edge of an image. The steps for edge thresholding are:-

    1. Gaussian filter is used to smooth an image and minimize the unwanted noise; the raw image is convolved with Gaussian filter resulting in a slightly blurred image.

      , = , (, ) 2.3


      = 1 exp[ 2 + 2 ] 2.4

      the ratio of number of black pixel present in a binary image to that of the total number of pixels. Mathematically, BPR can be given by

      BPR= Number of black pixels in binary images/Total

      2 2

      2 2

      number of pixels

      Therefore, the method with less BPR is the best

      Gradient of g(x,y) is computed using sobel gradient operators to get

      , = 2 , + 2 (, ) ….2.5

      Thresholding method.



      , = tan1 [ , ]



      Value of threshold :

      , = , , >

      0 .2.7

      Where, T is so chosen that the noise is suppressed.

    2. Non-maxima pixels in the edges are suppressed in MT(x,y) to obtain thin edges while keeping in mind whether each non-zero MT(x,y) is greater than its two neighbors along the gradient direction (x,y). If so, keep MT(x, y) unchanged, otherwise, set it to 0.

    3. Two different thresholds T1and T2 (where T1

      > T2) is used to threshold the previous result and two binary images are obtained.

    4. Continuous edges are formed here. To do so, each segment in T1 is traced to its end and then its neighbors in T2 are searched to find any edge segment in T2 to bridge the gap until reaching another edge segment in T1.

    P-tile thresholding method:

    This method needs an image in which, it is assumed to consist of dark objects in a light background. The percentage which the dark object occupied is p%, knowing it the threshold is defined is defined as the highest gray level which maps at least (100 – p)% of the pixels into the objects in the threshold image. For example, suppose an object occupies 10% of an image, then the image should be threshold at the highest gray level that allows at least 10% of the pixels to be mapped into the object. This method is not applicative for unknown object area.


    The gray scale images each of size 256 x 256 are used evaluating the performance on MATLAB. The images that are used are bird image, boy image, building image, cameraman image and rose image. For every image, black to white pixels ratio (BWR) and black pixel ratio (BPR) are calculated. The performance of all the six thresholding techniques discussed above is taken on the basis of black pixel ratio (BPR). BPR is the parameter which is equal to

    Fig1: Thresholding results on Bird Image

    Fig 2: Thresholding results on Boy Image

    Thresholding techniques

    Black to white pixel ratio

    BPR (%AGE)

    Mean thresholding



    Histogram thresholding



    Edge thresholding



    Variable thresholding



    P-tile thresholding



    Comparison of thresholding techniques for bird image

    Thresholding techniques

    Black to white pixel ratio

    BPR (%AGE)

    Mean Thresholding



    Histogram Thresholding



    Edge Thresholding



    Variable Thresholding



    P-tile Thresholding



    Comparison of Thresholding techniques for boy image


    In this paper, we make a categorized survey of various image thresholding techniques. The different techniques of thresholding have been applied to different images, which illustrate the shortcomings and advantages of the different methods. From the above results we can conclude that the value of BPR is less in histogram thresholding as compared to other methods. So, we can say it is the best thresholding method in the above discussed method.


The paper is written under the guidance and support of my department who encouraged me in completion of the work

.I would like to thank to everyone who helped me and motivated me by which the work is made possible.


  1. Sankur, B. and Sezgin,M., 2004, Survey over image thresholding techniques and quantitative performance evaluation, Journal of Electronic Imaging 13(1), pp. 146165.

  2. Polak, M., Zhang, H. and Pi, M., 2009, An evaluation metric for image segmentation of multiple objects,Image and Vision Computing 27(8),1223-1227.

  3. Sang, U.K. LEE, Seok, Y. C., and Rae, H. P., 1990, A Comparative Performance Study of Several Global Thresholding Techniques for Segmentation, Computer Vision, Graphics, And Image Processing 52, pp. 171-190.

  4. Abutaleb, A.S., 1989, Automatic Thresholding of Gray-Level Pictures Using Two Dimensional Entropy, Computer Vision, Graphics, and Image Processing, 47, pp.22-32.

  5. Ramesh, N., Yoo, J.H. and Sethi, I.K., 1995, Thresholding Based on Histogram Approximation, IEE Proc. Vis. Image, Signal Proc., 142(5), pp. 271-279.

  6. Guo, R. And Pandit, S.M., 1998, Automatic threshold selection based on histogram modes and a discriminant criterion, Machine Vision and Applications, 10, pp. 331-338.

  7. Jain A. , 1986, Fundamentals of Digital Image Processing,

Prentice-Hall, p-40.

Leave a Reply