OcrInput

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public class OcrInput implements Iterable<ImageData>

Main class for recognize text from images.

Constructors

ConstructorDescription
OcrInput(InputType type, PreprocessingFilter filters)Constructor to create container and set the type of images / documents and filters for further processing / recognition.
OcrInput(InputType type)

Methods

MethodDescription
replaceFilters(PreprocessingFilter filters)Remove old filters and set new.
clearFilters()Remove all filters.
add(String fullPath)Add the path or URI containing the image for recognition / processing.
add(BufferedImage image)Add the BufferedImage containing the image for recognition / processing.
add(String fullPath, int startPage, int pagesCount)Add the multipage images / documents for recognition / processing.
add(BufferedImage image, int startPage, int pagesCount)Add the BufferedImage containing the multipage image for recognition / processing.
add(int[] pixels, int width, int height, int bitsPerPixel)Add the decoded image to the list for recognition / processing.
add(InputStream stream)Add the InputStream containing the image for recognition / processing.
add(InputStream stream, int startPage, int pagesCount)Add the InputStream containing the multipage image for recognition / processing.
addBase64(String base64)Add the base64 string containing the image for recognition / processing.
clear()Set the amount of items for processing / recognition as 0.
size()Amount of items for processing / recognition.
get(int index)Returns information about processed / recognized image.
iterator()

OcrInput(InputType type, PreprocessingFilter filters)

public OcrInput(InputType type, PreprocessingFilter filters)

Constructor to create container and set the type of images / documents and filters for further processing / recognition.

Parameters:

ParameterTypeDescription
typeInputTypeSet the images/documents type will be added to container.
filtersPreprocessingFilterSet processing filters will be applied for further processing or recognition.

OcrInput(InputType type)

public OcrInput(InputType type)

Parameters:

ParameterTypeDescription
typeInputType

replaceFilters(PreprocessingFilter filters)

public void replaceFilters(PreprocessingFilter filters)

Remove old filters and set new.

Parameters:

ParameterTypeDescription
filtersPreprocessingFilterProcessing filters will be applied for further processing or recognition.

clearFilters()

public void clearFilters()

Remove all filters.

add(String fullPath)

public void add(String fullPath)

Add the path or URI containing the image for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
fullPathjava.lang.StringPath to the image/ document / folder / archive.

add(BufferedImage image)

public void add(BufferedImage image)

Add the BufferedImage containing the image for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
imagejava.awt.image.BufferedImageBufferedImage containing the image or document.

add(String fullPath, int startPage, int pagesCount)

public void add(String fullPath, int startPage, int pagesCount)

Add the multipage images / documents for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
fullPathjava.lang.StringPath to the image/ document / folder / archive.
startPageintThe first page/image for processing / recognition. Use for documents, zip, folders.
pagesCountintThe total amount of pages/images for processing / recognition. Use for documents, zip, folders. Default = all.

add(BufferedImage image, int startPage, int pagesCount)

public void add(BufferedImage image, int startPage, int pagesCount)

Add the BufferedImage containing the multipage image for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
imagejava.awt.image.BufferedImageBufferedImage containing the multipage document.
startPageintThe first page/image for processing / recognition. Use for documents.
pagesCountintThe total amount of pages/images for processing / recognition. Use for documents. Default = all.

add(int[] pixels, int width, int height, int bitsPerPixel)

public void add(int[] pixels, int width, int height, int bitsPerPixel)

Add the decoded image to the list for recognition / processing. The type of the image must correspond to the type specified in the constructor (SingleImage).

Parameters:

ParameterTypeDescription
pixelsint[]The pixels are represented as 32-bit integer values (rgb).
widthintImage width.
heightintImage height.
bitsPerPixelintSupports 1-32 bits.

add(InputStream stream)

public void add(InputStream stream)

Add the InputStream containing the image for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamInputStream containing the image or document.

add(InputStream stream, int startPage, int pagesCount)

public void add(InputStream stream, int startPage, int pagesCount)

Add the InputStream containing the multipage image for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
streamjava.io.InputStreamInputStream containing the multipage document.
startPageintThe first page/image for processing / recognition. Use for documents.
pagesCountintThe total amount of pages/images for processing / recognition. Use for documents. Default = all.

addBase64(String base64)

public void addBase64(String base64)

Add the base64 string containing the image for recognition / processing. The type of the image must correspond to the type specified in the constructor.

Parameters:

ParameterTypeDescription
base64java.lang.StringBase64 string with single image.

clear()

public void clear()

Set the amount of items for processing / recognition as 0. Clear the collection.

size()

public int size()

Amount of items for processing / recognition.

Returns: int - Amount of items.

get(int index)

public ImageData get(int index)

Returns information about processed / recognized image.

Parameters:

ParameterTypeDescription
indexintPosition of the image in the List.

Returns: ImageData - The object of @see ImageData

iterator()

public Iterator<ImageData> iterator()

Returns: java.util.Iterator<com.aspose.ocr.ImageData>