Class RecognitionResult

Class RecognitionResult

Namespace: Aspose.OCR
Assembly: Aspose.OCR.dll (25.1.0)

图像识别的结果。
包含带有识别信息的元素和结果导出的方法。

public class RecognitionResult

继承

objectRecognitionResult

继承成员

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

属性

文件名

文件的完整路径。

public string FileName { get; set; }

属性值

string

图像

获取或设置用于 PDF 创建的图像。

public byte[][,] Image { get; set; }

属性值

byte[][,]

识别区域矩形

获取矩形坐标。

public List<rectangle> RecognitionAreasRectangles { get; }

属性值

List<rectangle>

识别区域文本

获取区域(矩形)列表的识别结果。

public List<string> RecognitionAreasText { get; }

属性值

List<string&gt;

识别字符列表

识别算法找到的一组字符,按概率降序排列。

public List<char[]> RecognitionCharactersList { get; }

属性值

List<char[]&gt;

备注

具有最大概率和替代选项的符号数组 System.Char。

识别行结果

获取带有行(矩形)列表的识别结果。

public List<recognitionresult.linesresult> RecognitionLinesResult { get; }

属性值

List<RecognitionResult.LinesResult&gt;

识别文本

以一个字符串获取识别结果。

public string RecognitionText { get; set; }

属性值

string

倾斜

获取倾斜角度。

public float Skew { get; set; }

属性值

float

警告

获取描述在生成过程中出现的非关键故障的警告消息列表。

public List<string> Warnings { get; }

属性值

List<string&gt;

方法

GetJson(bool)

形成带有识别结果的 JSON 字符串。

public string GetJson(bool isReadable = false)

参数

isReadable bool

确定 JSON 是否可读。

返回

string

识别结果作为 JSON 字符串。

GetKeywords()

从护照中获取关键字(测试模式,仅适用于美国和马达加斯加护照)。

public Dictionary<string, recognitionresult.linesresult=""> GetKeywords()

返回

Dictionary<string, RecognitionResult.LinesResult&gt;

以关键字为键,以 LinesResult 为值的字典。

GetSpellCheckCorrectedText(SpellCheckLanguage, string)

修正文本(替换拼写错误的单词)。

public string GetSpellCheckCorrectedText(SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null)

参数

language SpellCheckLanguage

要使用的字典。

dictionaryPath string

可选。用户字典的完整路径(频率字典)。 字典文件格式: UTF-8 编码的纯文本文件。 单词和单词频率用空格或制表符分隔。默认情况下,单词预期在第一列,频率在第二列。 每个单词-频率对在单独的行中定义。行定义为字符序列后跟换行符("\n")、回车符("\r")或回车符后紧跟换行符("\r\n")。 每个单词预期为小写。

返回

string

替换单词后的文本。

GetSpellCheckErrorList(SpellCheckLanguage, string)

查找给定输入文本的拼写错误单词及建议拼写。

public List<spellcheckerror> GetSpellCheckErrorList(SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null)

参数

language SpellCheckLanguage

要使用的字典。

dictionaryPath string

可选。用户字典的完整路径(频率字典)。 字典文件格式: UTF-8 编码的纯文本文件。 单词和单词频率用空格或制表符分隔。默认情况下,单词预期在第一列,频率在第二列。 每个单词-频率对在单独的行中定义。行定义为字符序列后跟换行符("\n")、回车符("\r")或回车符后紧跟换行符("\r\n")。 每个单词预期为小写。

返回

List<SpellCheckError&gt;

表示拼写错误单词的 SpellCheckError 对象列表,以及每个拼写错误单词的建议正确拼写列表和编辑距离。

GetXml()

形成带有识别结果的 XML 字符串。

public string GetXml()

返回

string

识别结果作为字符串 XML 序列化。

Save(string, SaveFormat, bool, SpellCheckLanguage, string, string, PdfOptimizationMode)

将文档保存为纯文本、PDF 或 Microsoft Word 文档。

public void Save(string fullFileName, SaveFormat saveFormat, bool applySpellingCorrection, SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)

参数

fullFileName string

用于保存识别结果的文件名及路径,格式为所选格式。

saveFormat SaveFormat

文档格式(Docx、Txt、Pdf、Xlsx、Rtf、Json、Xml)。

applySpellingCorrection bool

设置为 true 以在识别结果中纠正拼写错误的单词(如果有)。

language SpellCheckLanguage

拼写检查的字典(可选)。

dictionaryPath string

可选。用户字典的完整路径,格式为 .txt。格式为 [word - space - frequency(number)]。 示例:the 23135851162\nthat 3400031103\n

embeddedFontPath string

可选。用户字体的完整路径。

optimizePdf PdfOptimizationMode

通过降低背景图像的质量来减少 PDF 文件大小。默认情况下,保留原始图像质量。

Save(string, SaveFormat, string, PdfOptimizationMode)

将文档保存为纯文本、PDF 或 Microsoft Word 文档。

public void Save(string fullFileName, SaveFormat saveFormat, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)

参数

fullFileName string

用于保存识别结果的文件名及路径,格式为所选格式。

saveFormat SaveFormat

文档格式(Docx、Txt、Pdf、Xlsx、Rtf、Json、Xml)。

embeddedFontPath string

可选。用户字体的完整路径。

optimizePdf PdfOptimizationMode

通过降低背景图像的质量来减少 PDF 文件大小。默认情况下,保留原始图像质量。

Save(MemoryStream, SaveFormat, bool, SpellCheckLanguage, string, string, PdfOptimizationMode)

将文档保存为纯文本、PDF 或 Microsoft Word 文档。

public void Save(MemoryStream stream, SaveFormat saveFormat, bool applySpellingCorrection, SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)

参数

stream MemoryStream

用于保存识别结果的 MemoryStream,格式为所选格式。

saveFormat SaveFormat

文档格式(Docx、Txt、Pdf)。

applySpellingCorrection bool

设置为 true 以在识别结果中纠正拼写错误的单词(如果有)。

language SpellCheckLanguage

拼写检查的字典(可选)。

dictionaryPath string

可选。用户字典的完整路径,格式为 .txt。格式为 [word - space - frequency(number)]。 示例:the 23135851162\nthat 3400031103\n

embeddedFontPath string

可选。用户字体的完整路径。

optimizePdf PdfOptimizationMode

通过降低背景图像的质量来减少 PDF 文件大小。默认情况下,保留原始图像质量。

Save(MemoryStream, SaveFormat, string, PdfOptimizationMode)

将文档保存为纯文本、PDF 或 Microsoft Word 文档。

public void Save(MemoryStream stream, SaveFormat saveFormat, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)

参数

stream MemoryStream

用于保存识别结果的 MemoryStream,格式为所选格式。

saveFormat SaveFormat

文档格式(Docx、Txt、Pdf)。

embeddedFontPath string

可选。用户字体的完整路径。

optimizePdf PdfOptimizationMode

通过降低背景图像的质量来减少 PDF 文件大小。默认情况下,保留原始图像质量。

运算符

operator +(RecognitionResult, RecognitionResult)

从识别的片段(行)完成完整结果。

public static RecognitionResult operator +(RecognitionResult main, RecognitionResult part)

参数

main RecognitionResult

将添加右操作数的对象。

part RecognitionResult

右操作数。

返回

RecognitionResult

左操作数。

 中文