Thresholding (image processing)
   HOME

TheInfoList



OR:

In
digital image processing Digital image processing is the use of a digital computer to process digital images through an algorithm. As a subcategory or field of digital signal processing, digital image processing has many advantages over analog image processing. It allo ...
, thresholding is the simplest method of segmenting images. From a
grayscale In digital photography, computer-generated imagery, and colorimetry, a grayscale image is one in which the value of each pixel is a single sample representing only an ''amount'' of light; that is, it carries only intensity information. Graysc ...
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_ 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. 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. 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 Entropy is a scientific concept, as well as a measurable physical property, that is most commonly associated with a state of disorder, randomness, or uncertainty. The term and the concept are used in diverse fields, from classical thermodynam ...
-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.


Global vs local thresholding

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 or the Bernsen algorithms. Software such as
ImageJ ImageJ is a Java-based image processing program developed at the National Institutes of Health and the Laboratory for Optical and Computational Instrumentation (LOCI, University of Wisconsin). Its first version, ImageJ 1.x, is developed in the pub ...
propose a wide range of automatic threshold methods, bot
global
an
local


Extensions of binary thresholding


Multi-band images

Color images can also be thresholded. One approach is to designate a separate threshold for each of the
RGB The RGB color model is an additive color model in which the red, green and blue primary colors of light are added together in various ways to reproduce a broad array of colors. The name of the model comes from the initials of the three addi ...
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 HSL (for hue, saturation, lightness) and HSV (for hue, saturation, value; also known as HSB, for hue, saturation, brightness) are alternative representations of the RGB color model, designed in the 1970s by computer graphics researchers to mor ...
color models are more often used; note that since
hue In color theory, hue is one of the main properties (called color appearance parameters) of a color, defined technically in the CIECAM02 model as "the degree to which a stimulus can be described as similar to or different from stimuli that ...
is a circular quantity it requires circular thresholding. It is also possible to use the
CMYK The CMYK color model (also known as process color, or four color) is a subtractive color model, based on the CMY color model, used in color printing, and is also used to describe the printing process itself. The abbreviation ''CMYK'' refers ...
color model.


Multiple thresholds

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


Limitations

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 A false positive is an error in binary classification in which a test result incorrectly indicates the presence of a condition (such as a disease when the disease is not present), while a false negative is the opposite error, where the test result ...
.


References


Sources

* 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. * Mehmet Sezgin and Bulent Sankur, Survey over image thresholding techniques and quantitative performance evaluation, Journal of Electronic Imaging 13(1), 146–165 (January 2004).


Further reading

*Gonzalez, Rafael C. & Woods, Richard E. (2002). Thresholding. In Digital Image Processing, pp. 595–611. Pearson Education. *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. *Y.K. Lai, P.L. Rosin, Efficient Circular Thresholding, IEEE Trans. on Image Processing 23(3), pp. 992–1001 (2014). *Scott E. Umbaugh (2018). Digital Image Processing and Analysis, pp 93–96. CRC Press. {{ISBN, 978-1-4987-6602-9 Image segmentation