PreprocessingFilter

PreprocessingFilter class

Module: models

Inherits: BaseJavaClass

Base class for image processing commands.

Constructors

NameDescription
init

Methods

NameReturn TypeStaticDescription
addNoAdd filter to collection for further preprocessing.
auto_denoisingYesEnables the use of an additional neural network to improve the image - reduce noise. Useful for images with scan artifacts, distortion, spots, flares, gradients, foreign elements.
auto_dewarpingYesAutomatically corrects geometric distortions in the image. Extremely resource intensive!
auto_skewYesEnables the automatic image skew correction.
binarizeYesConverts an image to black-and-white image. Binary images are images whose pixels have only two possible intensity values. They are normally displayed as black and white. Numerically, the two values are often 0 for black, and 255 for white. Binary images are produced by auto thresholding an image.
binarize_and_dilateYesDilation adds pixels to the boundaries of objects in an image.
contrast_correctionYesContrast correction filter.
getJavaClassNo
invertYesAutomatically inverts colors in a document image.
medianYesThe median filter run through each element of the image and replace each pixel with the median of its neighboring pixels.
resizeYesRescale image - upscale or downscale image resolution.
rotateYesRotate original image.
scaleYesRescale image - Upscale or downscale image resolution. InterpolationFilterType bilinear or nearest neighbor.
thresholdYesCreate a binary image based on setting a threshold value on the pixel intensity of the original image.
to_grayscaleYesConverts an image to grayscale image. Grayscale image have 256 level of light in image (0 to 255).

Fields

NameValueDescription
JAVA_CLASS_NAME"com.aspose.ocr.PreprocessingFilter"

PreprocessingFilter Constructor

__init__(self)

PreprocessingFilter.add

add(self, filter)

Add filter to collection for further preprocessing.

ParameterTypeDescription
filter``PreprocessingFilter object.

PreprocessingFilter.auto_denoising (static)

auto_denoising()

Enables the use of an additional neural network to improve the image - reduce noise. Useful for images with scan artifacts, distortion, spots, flares, gradients, foreign elements.

PreprocessingFilter.auto_dewarping (static)

auto_dewarping()

Automatically corrects geometric distortions in the image. Extremely resource intensive!

PreprocessingFilter.auto_skew (static)

auto_skew()

Enables the automatic image skew correction.

PreprocessingFilter.binarize (static)

binarize()

Converts an image to black-and-white image. Binary images are images whose pixels have only two possible intensity values. They are normally displayed as black and white. Numerically, the two values are often 0 for black, and 255 for white. Binary images are produced by auto thresholding an image.

PreprocessingFilter.binarize_and_dilate (static)

binarize_and_dilate()

Dilation adds pixels to the boundaries of objects in an image.

PreprocessingFilter.contrast_correction (static)

contrast_correction()

Contrast correction filter.

PreprocessingFilter.getJavaClass

getJavaClass(self)

PreprocessingFilter.invert (static)

invert()

Automatically inverts colors in a document image.

PreprocessingFilter.median (static)

median()

The median filter run through each element of the image and replace each pixel with the median of its neighboring pixels.

PreprocessingFilter.resize (static)

resize(int width, int height)

Rescale image - upscale or downscale image resolution.

ParameterTypeDescription
widthintThe new width of the image.
heightintThe new height of the image.

PreprocessingFilter.rotate (static)

rotate(float angle)

Rotate original image.

ParameterTypeDescription
anglefloatAngle of rotation. Value from -360 to 360.

PreprocessingFilter.scale (static)

scale(float ratio)

Rescale image - Upscale or downscale image resolution. InterpolationFilterType bilinear or nearest neighbor.

ParameterTypeDescription
ratiofloatThe scaling factor. Recommended value from 0.1 to 1 to shrink. From 1 to 10 to enlarge.

PreprocessingFilter.threshold (static)

threshold(int value)

Create a binary image based on setting a threshold value on the pixel intensity of the original image.

ParameterTypeDescription
valueintThe max value.

PreprocessingFilter.to_grayscale (static)

to_grayscale()

Converts an image to grayscale image. Grayscale image have 256 level of light in image (0 to 255).

PreprocessingFilter.JAVA_CLASS_NAME

Type: str

Value: "com.aspose.ocr.PreprocessingFilter"