Adaptive thresholding has been discussed in a few questions earlier:

Adaptive Thresholding for liver segmentation using Matlab

What are the best algorithms for document image thresholding in this example?

Of course, there are many algorithms for Adaptive thresholding. I want to know which ones you have found most effective and useful.

Which Adaptive algorithms you have used the most and for which application; how do you come to choose this algorithm?


3 Answers 3


I do not think mine will be a complete answer, but I'll offer what I know and since this is a community edited site, I hope somebody will give a complimentary answer soon :)

Adaptive thresholding methods are those that do not use the same threshold throughout the whole image.

But, for some simpler usages, it is sometimes enough to just pick a threshold with a method smarter than the most simple iterative method. Otsu's method is a popular thresholding method that assumes the image contains two classes of pixels - foreground and background, and has a bi-modal histogram. It then attempts to minimize their combined spread (intra-class variance).

The simplest algorithms that can be considered truly adaptive thresholding methods would be the ones that split the image into a grid of cells and then apply a simple thresholding method (e.g. iterative or Otsu's method) on each cell treating it as a separate image (and presuming a bi-modal histogram). If a sub-image can not be thresholded good the threshold from one of the neighboring cells can be used.

Alternative approach to finding the local threshold is to statistically examine the intensity values of the local neighborhood of each pixel. The threshold is different for each pixel and calculated from it's local neighborhood (a median, average, and other choices are possible). There is an implementation of this kind of methods included in OpenCV library in the cv::adaptiveThresholding function.

I found another similar method called Bradley Local Thresholding. It also examines the neighborhood of each pixel, setting the brightnes to black if the pixels brightness is t percent lower than the average brightness of surrounding pixels. The corresponding paper can be found here.

This stackoverflow answer mentiones a local (adaptive) thresholding method called Niblack but I have not heard of it before.

Lastly, there is a method I have used in one of my previous smaller projects, called Image Thresholding by Variational Minimax Optimization. It is an iterative method, based on optimizing an energy function that is a nonlinear combination of two components. One component aims to calculate the threshold based on the position of strongest intensity changes in the image. The other component aims to smooth the threshold at the (object)border areas. It has proven fairly good on images of analog instruments (various shading and reflection from glass/plastic present), but required a careful choice of the number of iterations.

Late edit: Inspired by the comment to this answer. There is one more way I know of to work around uneven lighting conditions. I will write here about bright objects on a dark background, but the same reasoning can be applied if the situation is reverse. Threshold the white top-hat transform of the image with a constant threshold instead of the original image. A white top hat of an image is nothing but a difference between the image $f$ and it's opening $\gamma(f)$. As further explanation let me offer a quote from P. Soille: Morphological Image Analysis:

An opening of the original image with a large square SE removes all relevant image structures but preserves the illumination function. The white top-hat of the original image or subtraction of the illumination function from the original image outputs an image with a homogeneous illumination.


You can find a paper containing a comparison of a number of thresholding methods here:

  • M. Sezgin, B. Sankur - Survey over image thresholding techniques and quantitative performance evaluation, Journal of Electronic Imaging, 2004 - pdf

Here's another paper evaluating binarization methods:

  • P. Stathis, E. Kavallieratou and N. Papamarkos - An Evaluation Technique for Binarization Algorithms, Journal of Universal Computer Science, 2008, - pdf

The adaptive binarization method I have used in my last project uses integral images for fast computation of the threshold function used by the Sauvola method. The Sauvola method is described in:

  • J. Sauvola and M. Pietikainen, Adaptive document image binarization, Pattern Recognition 33, 2000. - pdf

The modification which uses integral images providing a 20-fold speedup (according to the paper) is described in this paper:

  • F. Shafait, D. Keysers, and T. M. Breuel, Efficient implementation of local adaptive thresholding techniques using integral images, Document Recognition and Retrieval XV, 2008 - pdf

These are just the papers I used when choosing the binarization method for my project (for finding text in images). I'm not an expert so I can't say which method is the best for which application.


This question has been answered very well from different perspectives, and I just want to summarize my experience and also emphasize some problems related to adaptive binarization.

Adaptive binarization can be divided into three categories:

1) Global method: with this method first of the background of the image is estimated; after that a normalized image is generated with the help of the background information. Then global binarization method is employed.

2) Patch-based method: as the name indicates, patch-based method will perform binarization patch by patch. At each patch, a binarization is estimated with a global binarization method. After that, some post-processing is performed to make sue that binarization threshold in neighboring patches has smooth transition.

3) Moving-window method: with this method, binarization is done pixel by pixel. A moving window is set up to calculate the pixel statistics within the window, and based on the statistics the threshold for the central pixel within the window is calculated.

It is very hard to tell which method is the best as it depends on the application. When you think of an adaptive binarization, do not forget to consider the following questions:

1) parameter setting: does the method have an automatic parameter setting procedure? How can we set the parameters very well so that it can work on most cases?

2) what is the criterion of justifying a good adaptive binarization? In many cases, the difference between different binarization methods is really small. However, the small difference may lead to big difference in the end.

3) can binarization work on some particular situations? For example, suppose the target of the adaptive binarization is to extract while objects from black background, can the binarization automatically adapt to this situation? Or vice visa.

4) adaptive methods have the tendency of only focusing on the local configurations, hence the binary result is not optimized. For example, the famous Sauvola method will generate hollow object if the object to be optimized is far larger than the moving window. Can your adaptive method conque this limitation?

5) preprocessing. A good binarization also should include image processing insider. If the image is too blurring, it can automatically adjust the parameters of the algorithm or invoke some preprocessing to avoid bad binarization.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.