public class ThresholdSauvola_MT extends java.lang.Object implements InputToBinary<boofcv.struct.image.GrayF32>
Intended 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 and Description |
|---|
ThresholdSauvola_MT(boofcv.struct.ConfigLength width,
float k,
boolean down)
Configures the algorithm.
|
| Modifier and Type | Method and Description |
|---|---|
boofcv.struct.image.ImageType<boofcv.struct.image.GrayF32> |
getInputType() |
float |
getK() |
boofcv.struct.ConfigLength |
getWidth() |
boolean |
isDown() |
void |
process(boofcv.struct.image.GrayF32 input,
boofcv.struct.image.GrayU8 output)
Converts the input image into a binary image.
|
void |
setDown(boolean down) |
void |
setK(float k) |
void |
setWidth(boofcv.struct.ConfigLength width) |
public ThresholdSauvola_MT(boofcv.struct.ConfigLength width,
float k,
boolean down)
width - size of local region. Try 31k - User specified threshold adjustment factor. Must be positive. Try 0.3down - Threshold down or uppublic void process(boofcv.struct.image.GrayF32 input,
boofcv.struct.image.GrayU8 output)
process in interface InputToBinary<boofcv.struct.image.GrayF32>input - Input image. Not modified.output - Output binary image. Modified.public boofcv.struct.image.ImageType<boofcv.struct.image.GrayF32> getInputType()
getInputType in interface InputToBinary<boofcv.struct.image.GrayF32>public float getK()
public void setK(float k)
public boofcv.struct.ConfigLength getWidth()
public void setWidth(boofcv.struct.ConfigLength width)
public boolean isDown()
public void setDown(boolean down)