OcrInput

Inheritance: java.lang.Object

All Implemented Interfaces: java.lang.Iterable

public class OcrInput implements Iterable<ImageData>

用于从图像中识别文本的主类。

构造函数

构造函数描述
OcrInput(InputType type, PreprocessingFilter filters)构造函数用于创建容器并设置图像/文档的类型以及后续处理/识别的过滤器。
OcrInput(InputType type)

方法

方法描述
add(int[] pixels, int width, int height, int bitsPerPixel)将解码后的图像添加到用于识别/处理的列表中。
add(BufferedImage image)添加包含图像的 BufferedImage 以进行识别/处理。
add(BufferedImage image, int startPage, int pagesCount)添加包含多页图像的 BufferedImage 以进行识别/处理。
add(InputStream stream)添加包含图像的 InputStream 以进行识别/处理。
add(InputStream stream, int startPage, int pagesCount)添加包含多页图像的 InputStream 以进行识别/处理。
add(String fullPath)添加包含图像的路径或 URI 以进行识别/处理。
add(String fullPath, int startPage, int pagesCount)添加多页图像/文档以进行识别/处理。
addBase64(String base64)添加包含图像的 base64 字符串以进行识别/处理。
clear()将处理/识别的项目数量设置为 0。
clearFilters()移除所有过滤器。
equals(Object arg0)
get(int index)返回有关已处理/已识别图像的信息。
getClass()
hashCode()
iterator()
notify()
notifyAll()
replaceFilters(PreprocessingFilter filters)移除旧过滤器并设置新过滤器。
size()用于处理/识别的项目数量。
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

OcrInput(InputType type, PreprocessingFilter filters)

public OcrInput(InputType type, PreprocessingFilter filters)

构造函数用于创建容器并设置图像/文档的类型以及后续处理/识别的过滤器。

Parameters:

参数类型描述
typeInputType设置将添加到容器的图像/文档类型。
filtersPreprocessingFilter设置的处理过滤器将用于后续的处理或识别。

OcrInput(InputType type)

public OcrInput(InputType type)

Parameters:

参数类型描述
typeInputType

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

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

将解码后的图像添加到用于识别/处理的列表中。图像的类型必须与构造函数中指定的类型(SingleImage)相对应。

Parameters:

参数类型描述
像素int[]像素以 32 位整数值(rgb)表示。
宽度int图像宽度。
高度int图像高度。
bitsPerPixelint支持 1-32 位。

add(BufferedImage image)

public void add(BufferedImage image)

添加包含图像的 BufferedImage 以进行识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
图像java.awt.image.BufferedImage包含图像或文档的 BufferedImage。

add(BufferedImage image, int startPage, int pagesCount)

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

添加包含多页图像的 BufferedImage 以进行识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
图像java.awt.image.BufferedImage包含多页文档的 BufferedImage。
startPageint用于处理/识别的第一页/图像。用于文档。
pagesCountint用于处理/识别的页面/图像的总数量。用于文档。默认 = 全部。

add(InputStream stream)

public void add(InputStream stream)

添加包含图像的 InputStream 以进行识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
streamjava.io.InputStream包含图像或文档的 InputStream。

add(InputStream stream, int startPage, int pagesCount)

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

添加包含多页图像的 InputStream 用于识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
streamjava.io.InputStream包含多页文档的 InputStream。
startPageint用于处理/识别的第一页/图像。用于文档。
pagesCountint用于处理/识别的页面/图像的总数量。用于文档。默认 = 全部。

add(String fullPath)

public void add(String fullPath)

添加包含图像的路径或 URI 用于识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
fullPathjava.lang.String图像/文档/文件夹/存档的路径。

add(String fullPath, int startPage, int pagesCount)

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

添加多页图像/文档用于识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
fullPathjava.lang.String图像/文档/文件夹/存档的路径。
startPageint用于处理/识别的第一页/图像。适用于文档、zip、文件夹。
pagesCountint用于处理/识别的页面/图像总数。适用于文档、zip、文件夹。默认 = 全部。

addBase64(String base64)

public void addBase64(String base64)

添加包含图像的 base64 字符串用于识别/处理。图像的类型必须与构造函数中指定的类型相对应。

Parameters:

参数类型描述
base64java.lang.String包含单个图像的 Base64 字符串。

clear()

public void clear()

将用于处理/识别的项目数量设置为 0。清空集合。

clearFilters()

public void clearFilters()

移除所有过滤器。

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

参数类型描述
arg0java.lang.Object

Returns: boolean

get(int index)

public ImageData get(int index)

返回有关已处理/已识别图像的信息。

Parameters:

参数类型描述
索引int图像在列表中的位置。

Returns: ImageData - The object of @see ImageData

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

hashCode()

public native int hashCode()

Returns: int

iterator()

public Iterator<ImageData> iterator()

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

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

replaceFilters(PreprocessingFilter filters)

public void replaceFilters(PreprocessingFilter filters)

移除旧过滤器并设置新过滤器。

Parameters:

参数类型描述
filtersPreprocessingFilter处理过滤器将用于后续的处理或识别。

size()

public int size()

用于处理/识别的项目数量。

Returns: int - 项目数量。

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

参数类型描述
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

参数类型描述
arg0long
arg1int