Thresholding (image processing)

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Original image.
The binary image resulting from a thresholding of the original image.

In digital image processing, thresholding is the simplest method of segmenting images. From a grayscale image, thresholding can be used to create binary images.[1]

Definition[edit]

The simplest thresholding methods replace each pixel in an image with a black pixel if the image intensity is less than a fixed value called the threshold , or a white pixel if the pixel intensity is greater than that threshold. In the example image on the right, this results in the dark tree becoming completely black, and the bright snow becoming completely white.

Automatic thresholding[edit]

While in some cases, the threshold can be selected manually by the user, there are many cases where the user wants the threshold to be automatically set by an algorithm. In those cases, the threshold should be the "best" threshold in the sense that the partition of the pixels above and below the threshold should match as closely as possible the actual partition between the two classes of objects represented by those pixels (e.g., pixels below the threshold should correspond to the background and those above to some objects of interest in the image).

Many types of automatic thresholding methods exist, the most famous and widely used being Otsu's method. The following list, based on the works of Sezgin et al. (2004) categorizes thresholding methods into broad groups based on the information the algorithm manipulates. Note however that such a categorization is necessarily fuzzy as some methods can fall in several categories (for example, Otsu's method can be both considered a histogram-shape and a clustering algorithm)

  • Histogram shape-based methods, where, for example, the peaks, valleys and curvatures of the smoothed histogram are analyzed.[2] Note that these methods, more than others, make certain assumptions about the image intensity probability distribution (i.e., the shape of the histogram),
  • Clustering-based methods, where the gray-level samples are clustered in two parts as background and foreground,[3][4]
  • Entropy-based methods result in algorithms that use the entropy of the foreground and background regions, the cross-entropy between the original and binarized image, etc.,[5]
  • Object Attribute-based methods search a measure of similarity between the gray-level and the binarized images, such as fuzzy shape similarity, edge coincidence, etc.,
  • Spatial methods use higher-order probability distribution and/or correlation between pixels.
Example of the advantage of local thresholding in the case of inhomogeneous lighting. Image adapted from [1].

Global vs local thresholding[edit]

In most methods, the same threshold is applied to all the pixel of an image. However, in some cases, it can be advantageous to apply a different threshold to different parts of the image, based on the local value of the pixels. This category of methods is called local or adaptive thresholding. They are particularly adapted to cases where images have inhomogeneous lighting, such as in the sudoku image on the right. In those cases, a neighborhood is defined and a threshold is computed for each pixel and its neighborhood. Many global thresholding methods can be adapted to work in a local way, but there are also methods developed specifically for local thresholding, such as the Niblack[6] or the Bernsen algorithms.

Software such as ImageJ propose a wide range of automatic threshold methods, both global and local.

Extensions of binary thresholding[edit]

Multi-band images[edit]

Color images can also be thresholded. One approach is to designate a separate threshold for each of the RGB components of the image and then combine them with an AND operation. This reflects the way the camera works and how the data is stored in the computer, but it does not correspond to the way that people recognize color. Therefore, the HSL and HSV color models are more often used; note that since hue is a circular quantity it requires circular thresholding. It is also possible to use the CMYK color model.[7]

Multiple thresholds[edit]

Instead of a single threshold resulting in a binary image, it is also possible to introduce multiple increasing thresholds . In that case, implementing thresholds will result in an image with classes, where pixels with intensity such that will be assigned to class . Most of the binary automatic thresholding methods have a natural extension for multi-thresholding.

Limitations[edit]

Thresholding will work best under certain conditions :

  • low level of noise
  • higher intra-class variance than inter-class variance, i.e., pixels from a same group have closer intensities to each other than to pixels of another group,
  • homogeneous lighting, etc.

In difficult cases, thresholding will likely be imperfect and yield a binary image with false positives and false negatives.

References[edit]

  1. ^ (Shapiro, et al. 2001:83)
  2. ^ Zack, G W; Rogers, W E; Latt, S A (July 1977). "Automatic measurement of sister chromatid exchange frequency". Journal of Histochemistry & Cytochemistry. 25 (7): 741–753. doi:10.1177/25.7.70454. ISSN 0022-1554.
  3. ^ "Picture Thresholding Using an Iterative Selection Method". IEEE Transactions on Systems, Man, and Cybernetics. 8 (8): 630–632. 1978. doi:10.1109/TSMC.1978.4310039. ISSN 0018-9472.
  4. ^ Barghout, L.; Sheynin, J. (2013-07-25). "Real-world scene perception and perceptual organization: Lessons from Computer Vision". Journal of Vision. 13 (9): 709–709. doi:10.1167/13.9.709. ISSN 1534-7362.
  5. ^ Kapur, J. N.; Sahoo, P. K.; Wong, A. K. C. (1985-03-01). "A new method for gray-level picture thresholding using the entropy of the histogram". Computer Vision, Graphics, and Image Processing. 29 (3): 273–285. doi:10.1016/0734-189X(85)90125-2. ISSN 0734-189X.
  6. ^ Niblack, Wayne (1986). An introduction to digital image processing. Prentice-Hall International. ISBN 0-13-480600-X. OCLC 1244113797.
  7. ^ Pham, Nhu-An; Morrison, Andrew; Schwock, Joerg; Aviel-Ronen, Sarit; Iakovlev, Vladimir; Tsao, Ming-Sound; Ho, James; Hedley, David W. (2007-02-27). "Quantitative image analysis of immunohistochemical stains using a CMYK color model". Diagnostic Pathology. 2 (1): 8. doi:10.1186/1746-1596-2-8. ISSN 1746-1596. PMC 1810239. PMID 17326824.

Sources[edit]

  • Pham N, Morrison A, Schwock J et al. (2007). Quantitative image analysis of immunohistochemical stains using a CMYK color model. Diagn Pathol. 2:8.
  • Shapiro, Linda G. & Stockman, George C. (2002). "Computer Vision". Prentice Hall. ISBN 0-13-030796-3
  • Mehmet Sezgin and Bulent Sankur, Survey over image thresholding techniques and quantitative performance evaluation, Journal of Electronic Imaging 13(1), 146–165 (January 2004). doi:10.1117/1.1631315

Further reading[edit]

  • Gonzalez, Rafael C. & Woods, Richard E. (2002). Thresholding. In Digital Image Processing, pp. 595–611. Pearson Education. ISBN 81-7808-629-8
  • M. Luessi, M. Eichmann, G. M. Schuster, and A. K. Katsaggelos, Framework for efficient optimal multilevel image thresholding, Journal of Electronic Imaging, vol. 18, pp. 013004+, 2009. doi:10.1117/1.3073891
  • Y.K. Lai, P.L. Rosin, Efficient Circular Thresholding, IEEE Trans. on Image Processing 23(3), pp. 992–1001 (2014). doi:10.1109/TIP.2013.2297014
  • Scott E. Umbaugh (2018). Digital Image Processing and Analysis, pp 93–96. CRC Press. ISBN 978-1-4987-6602-9