Class ThresholdNiblackFamily

All Implemented Interfaces:
Direct Known Subclasses:

public class ThresholdNiblackFamily
extends Object
implements InputToBinary<GrayF32>

Several related algorithms based off the Niblack's [1] paper which are intended for use in thresholding images as a preprocessing step for OCR. All algorithms are based on local image statistics.

  1. Niblack: T(x,y) = m(x,y) * [ 1 + k * (s(x,y)/R - 1)]
  2. Sauvola: T(x,y) = m(x,y) * [ 1 + k * (s(x,y)/R - 1)]
  3. Wolf-Jolion: T(x,y) = m(x,y) * [ 1 + k * (s(x,y)/R - 1)]

where T(x,y) is the pixel's threshold, m(x,y) is the local mean, s(x,y) is the local deviation, R is dynamic range of standard deviation, and k is a user specified threshold.

There are two tuning parameters 'k' a positive number and the the 'radius' of the local region. Recommended values:

  • Niblack: k=0.3 and radius=15
  • Sauvola: k=0.3 and radius=15
  • Wolf-Jolion: k=0.5 and radius=15

[1] W.Niblack, An Introduction to Digital Image Processing. Prentice Hall, Englewood Cliffs, (1986).
[2] Sauvola, Jaakko, and Matti Pietikäinen. "Adaptive document image binarization." Pattern recognition 33.2 (2000): 225-236.
[3] C. Wolf, J-M. Jolion, “Extraction and Recognition of Artificial Text in Multimedia Documents”, Pattern Analysis and Applications, 6(4):309-326, (2003)

  • Constructor Details

    • ThresholdNiblackFamily

      public ThresholdNiblackFamily​(ConfigLength width, float k, boolean down, ThresholdNiblackFamily.Variant variant)
      Configures the algorithm.
      width - size of local region. Try 31
      k - User specified threshold adjustment factor. Must be positive. Try 0.3
      down - Threshold down or up
  • Method Details