public class Binarize extends Object
Modifier and Type | Field and Description |
---|---|
static float |
OTSU_SCORE_FRACTION
Fraction of the max Otsu score, typically 0.1
|
static int |
OTSU_SIZE_X
Desired tile X dimension; actual size may vary
|
static int |
OTSU_SIZE_Y
Desired tile Y dimension; actual size may vary
|
static int |
OTSU_SMOOTH_X
Desired X smoothing value
|
static int |
OTSU_SMOOTH_Y
Desired Y smoothing value
|
static int |
SAUVOLA_DEFAULT_NUM_TILES_X |
static int |
SAUVOLA_DEFAULT_NUM_TILES_Y |
static float |
SAUVOLA_DEFAULT_REDUCTION_FACTOR |
static int |
SAUVOLA_DEFAULT_WINDOW_HALFWIDTH |
Constructor and Description |
---|
Binarize() |
Modifier and Type | Method and Description |
---|---|
static Pix |
otsuAdaptiveThreshold(Pix pixs)
Performs locally-adaptive Otsu threshold binarization with default
parameters.
|
static Pix |
otsuAdaptiveThreshold(Pix pixs,
int sizeX,
int sizeY,
int smoothX,
int smoothY,
float scoreFraction)
Performs locally-adaptive Otsu threshold binarization.
|
static Pix |
sauvolaBinarizeTiled(Pix pixs)
Performs Sauvola binarization using default values.
|
static Pix |
sauvolaBinarizeTiled(Pix pixs,
int whsize,
float factor,
int nx,
int ny)
Performs Sauvola binarization.
|
public static final int OTSU_SIZE_X
public static final int OTSU_SIZE_Y
public static final int OTSU_SMOOTH_X
public static final int OTSU_SMOOTH_Y
public static final float OTSU_SCORE_FRACTION
public static final int SAUVOLA_DEFAULT_WINDOW_HALFWIDTH
public static final float SAUVOLA_DEFAULT_REDUCTION_FACTOR
public static final int SAUVOLA_DEFAULT_NUM_TILES_X
public static final int SAUVOLA_DEFAULT_NUM_TILES_Y
public static Pix otsuAdaptiveThreshold(Pix pixs)
pixs
- An 8 bpp PIX source image.public static Pix otsuAdaptiveThreshold(Pix pixs, int sizeX, int sizeY, int smoothX, int smoothY, float scoreFraction)
Notes:
pixs
- An 8 bpp PIX source image.sizeX
- Desired tile X dimension; actual size may vary.sizeY
- Desired tile Y dimension; actual size may vary.smoothX
- Half-width of convolution kernel applied to threshold
array: use 0 for no smoothing.smoothY
- Half-height of convolution kernel applied to threshold
array: use 0 for no smoothing.scoreFraction
- Fraction of the max Otsu score; typ. 0.1 (use 0.0
for standard Otsu).public static Pix sauvolaBinarizeTiled(Pix pixs)
pixs
- An 8 bpp PIX source image.sauvolaBinarizeTiled(Pix, int, float, int, int)
public static Pix sauvolaBinarizeTiled(Pix pixs, int whsize, float factor, int nx, int ny)
Notes:
pixs
- An 8 bpp PIX source image.whsize
- Window half-width for measuring local statisticsfactor
- Factor for reducing threshold due to variance; >= 0nx
- Subdivision into tiles; >= 1ny
- Subdivision into tiles; >= 1