Thresholding (image processing)
≈ 3 min read
Names in other languages
No names in other languages are held for this entry yet.
Article bodies are English and are not machine-translated. A name in another language is not a translation of the article.
In digital image processing, thresholding is the simplest method of segmenting images. From a grayscale image, thresholding can be used to create binary images.
In digital image processing, thresholding is the simplest method of segmenting images. From a grayscale image, thresholding can be used to create binary images. ==Definition== The simplest thresholding methods replace each pixel in an image with a black pixel if the image intensity I_{i,j} is less than a fixed value called the threshold T , 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== While in some cases, the threshold T 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. Sezgin et al 2004 categorized 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. 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, 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., 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. [[File:Example of adaptive thresholding.png|thumb|upright=1.4|Example of the advantage of local thresholding in the case of inhomogeneous lighting. Image adapted from [https://docs.opencv.org/3.4/d7/d4d/tutorial_py_thresholding.html].]] In most methods, the same threshold is applied to all pixels 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 or the Bernsen algorithms. Software such as ImageJ propose a wide range of automatic threshold methods, both global and local. ==Extensions of binary thresholding== ==References== ==Further reading== Gonzalez, Rafael C. & Woods, Richard E. (2002). Thresholding. In Digital Image Processing, pp. 595–611. Pearson Education. Scott E. Umbaugh (2018). Digital Image Processing and Analysis, pp 93–96. CRC Press.
Text derived from https://en.wikipedia.org/w/index.php?oldid=1321712601 under CC BY-SA 4.0; modifications have been made.