boofcv.alg.filter.binary.impl
Class ThresholdSauvola
- java.lang.Object
-
- boofcv.alg.filter.binary.impl.ThresholdSauvola
-
public class ThresholdSauvola extends java.lang.ObjectIntended for use as a preprocessing step in OCR it computes a binary image from an input gray image. It's an adaptive algorithm and uses the local mean and standard deviation, as is shown in the equation below:
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 are k=0.3 and radius=15. These were found by tuning against a set of text.
-
-
Constructor Summary
Constructors Constructor and Description ThresholdSauvola(int radius, float k, boolean down)Configures the algorithm.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description floatgetK()intgetRadius()booleanisDown()voidprocess(GrayF32 input, GrayU8 output)Converts the input image into a binary image.voidsetDown(boolean down)voidsetK(float k)voidsetRadius(int radius)
-
-
-
Constructor Detail
-
ThresholdSauvola
public ThresholdSauvola(int radius, float k, boolean down)Configures the algorithm.- Parameters:
radius- size of local radius. Try 15k- User specified threshold adjustment factor. Must be positive. Try 0.3down- Threshold down or up
-
-
Method Detail
-
process
public void process(GrayF32 input, GrayU8 output)
Converts the input image into a binary image.- Parameters:
input- Input image. Not modified.output- Output binary image. Modified.
-
getK
public float getK()
-
setK
public void setK(float k)
-
getRadius
public int getRadius()
-
setRadius
public void setRadius(int radius)
-
isDown
public boolean isDown()
-
setDown
public void setDown(boolean down)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG