Package io.scanbot.sdk.imageprocessing
Class CustomBinarizationFilter
java.lang.Object
io.scanbot.sdk.imageprocessing.ParametricFilter
io.scanbot.sdk.imageprocessing.CustomBinarizationFilter
Automatic binarization filter. This filter is a good starting point for most use cases.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs CustomBinarizationFilter with default parameters.CustomBinarizationFilter(OutputMode outputMode, double strokeWeight, double denoise, int radius, BinarizationFilterPreset preset) Constructs CustomBinarizationFilter with the given params. -
Method Summary
Modifier and TypeMethodDescriptiondoubleGetter for denoise field.Getter for outputMode field.Getter for preset field.intGetter for radius field.doubleGetter for strokeWeight field.voidsetDenoise(double denoise) Setter for denoise field.voidsetOutputMode(OutputMode outputMode) Setter for outputMode field.voidsetPreset(BinarizationFilterPreset preset) Setter for preset field.voidsetRadius(int radius) Setter for radius field.voidsetStrokeWeight(double strokeWeight) Setter for strokeWeight field.
-
Constructor Details
-
CustomBinarizationFilter
public CustomBinarizationFilter(OutputMode outputMode, double strokeWeight, double denoise, int radius, BinarizationFilterPreset preset) Constructs CustomBinarizationFilter with the given params.- Parameters:
outputMode- Output mode of the filter. BINARY will return a black and white image, ANTIALIASED will return an antialiased grayscale image. Default is `BINARY`.strokeWeight- Controls the bias towards thinner or thicker strokes. This bias determines how thin or thick text and lines appear. The valid range is from 0 to 1, where 0 implies a bias towards thinner strokes and 1 implies a bias towards thicker strokes. Thinner strokes look better in poorly lit images, images with heavy shadows, and, more generally, where text is blurry. Thicker strokes look better in well-lit images and, more generally, images with sharp text. The parameter has effect only when outputMode is set to ANTIALIASED. Default is `0.5`.denoise- Value controlling the amount of noise removal. Value between 0 and 1. Too little noise removal may result in a very noisy image, worsening readability. Too much noise removal may result in the degradation of text, again, worsening readability. Default is `0.5`.radius- Filter radius. The bigger the radius, the slower the filter and generally the less noise in the result. The radius is used for both shadows removal and the calculation of local statistics in the main body of the filter. Higher radius usually allows to cope better with regions of light text on dark background. All the values larger than 127 are clamped to 127. Default is `32`.preset- Preset of binarization filter parameters that are found to perform well on different types of documents. Default is `PRESET_4`.
-
CustomBinarizationFilter
public CustomBinarizationFilter()Constructs CustomBinarizationFilter with default parameters.
-
-
Method Details
-
getOutputMode
Getter for outputMode field. See constructor documentation for more information about the field.- Returns:
- outputMode
-
setOutputMode
Setter for outputMode field. See constructor documentation for more information about the field.- Parameters:
outputMode- Value to set.
-
getStrokeWeight
public double getStrokeWeight()Getter for strokeWeight field. See constructor documentation for more information about the field.- Returns:
- strokeWeight
-
setStrokeWeight
public void setStrokeWeight(double strokeWeight) Setter for strokeWeight field. See constructor documentation for more information about the field.- Parameters:
strokeWeight- Value to set.
-
getDenoise
public double getDenoise()Getter for denoise field. See constructor documentation for more information about the field.- Returns:
- denoise
-
setDenoise
public void setDenoise(double denoise) Setter for denoise field. See constructor documentation for more information about the field.- Parameters:
denoise- Value to set.
-
getRadius
public int getRadius()Getter for radius field. See constructor documentation for more information about the field.- Returns:
- radius
-
setRadius
public void setRadius(int radius) Setter for radius field. See constructor documentation for more information about the field.- Parameters:
radius- Value to set.
-
getPreset
Getter for preset field. See constructor documentation for more information about the field.- Returns:
- preset
-
setPreset
Setter for preset field. See constructor documentation for more information about the field.- Parameters:
preset- Value to set.
-