Class ThresholdNiblackFamily
- All Implemented Interfaces:
InputToBinary<GrayF32>
- Direct Known Subclasses:
ThresholdNiblackFamily_MT
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.
- Niblack: T(x,y) = m(x,y) * [ 1 + k * (s(x,y)/R - 1)]
- Sauvola: T(x,y) = m(x,y) * [ 1 + k * (s(x,y)/R - 1)]
- 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)
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic enum
Which variant of this family is computed -
Constructor Summary
ConstructorDescriptionThresholdNiblackFamily
(ConfigLength width, float k, boolean down, ThresholdNiblackFamily.Variant variant) Configures the algorithm. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyThresholding
(GrayF32 input, GrayU8 output) void
Converts the input image into a binary image.
-
Constructor Details
-
ThresholdNiblackFamily
public ThresholdNiblackFamily(ConfigLength width, float k, boolean down, ThresholdNiblackFamily.Variant variant) Configures the algorithm.- Parameters:
width
- size of local region. Try 31k
- User specified threshold adjustment factor. Must be positive. Try 0.3down
- Threshold down or up
-
-
Method Details
-
process
Converts the input image into a binary image.- Specified by:
process
in interfaceInputToBinary<GrayF32>
- Parameters:
input
- Input image. Not modified.output
- Output binary image. Modified.
-
applyThresholding
-
getInputType
- Specified by:
getInputType
in interfaceInputToBinary<GrayF32>
-