Class ThresholdNick

All Implemented Interfaces:

public class ThresholdNick extends Object implements InputToBinary<GrayF32>

Based off the NICK algorithm described in [1] this is a thresholding algorithm intended for use on low quality ancient documents. A sliding windows approach is employed and is inspired by Niblack. It's designed to better handled "white" and ligh page images by shifting the threshold down.

[1] Khurshid, Khurram, et al. "Comparison of Niblack inspired Binarization methods for ancient documents." Document Recognition and Retrieval XVI. Vol. 7247. International Society for Optics and Photonics, 2009.

  • Constructor Details

    • ThresholdNick

      public ThresholdNick(ConfigLength width, float k, boolean down)
      Configures the algorithm.
      width - size of local region. Try 31
      k - The Niblack factor. Recommend -0.1 to -0.2
      down - Threshold down or up
  • Method Details

    • process

      public void process(GrayF32 input, GrayU8 output)
      Converts the input image into a binary image.
      Specified by:
      process in interface InputToBinary<GrayF32>
      input - Input image. Not modified.
      output - Output binary image. Modified.
    • getInputType

      public ImageType<GrayF32> getInputType()
      Specified by:
      getInputType in interface InputToBinary<GrayF32>
    • getK

      public float getK()
    • setK

      public void setK(float k)
    • getWidth

      public ConfigLength getWidth()
    • setWidth

      public void setWidth(ConfigLength width)
    • isDown

      public boolean isDown()
    • setDown

      public void setDown(boolean down)