Class RecognitionResult
Namespace: Aspose.OCR
Assembly: Aspose.OCR.dll (25.2.0)
The results of the image recognition. Contains elements with recognition information and methods for result export.
public class RecognitionResult
Inheritance
Inherited Members
object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Properties
FileName
Full path to the file.
public string FileName { get; set; }
Property Value
Image
Gets or sets image for pdf creation.
public byte[][,] Image { get; set; }
Property Value
byte[][,]
RecognitionAreasRectangles
Gets rectangles coordinates.
public List<rectangle> RecognitionAreasRectangles { get; }
Property Value
List<rectangle>
RecognitionAreasText
Gets list recognition results of a list of areas (Rectangles).
public List<string> RecognitionAreasText { get; }
Property Value
RecognitionCharactersList
A set of characters found by the recognition algorithm and arranged in descending order of probability.
public List<char[]> RecognitionCharactersList { get; }
Property Value
Remarks
The array of symbols System.Char with the maximum probability and alternatives.
RecognitionLinesResult
Gets a list of recognition results with a list of rows (Rectangles).
public List<recognitionresult.linesresult> RecognitionLinesResult { get; }
Property Value
List<RecognitionResult.LinesResult>
RecognitionText
Gets recognition result in one string.
public string RecognitionText { get; set; }
Property Value
Skew
Gets skew angle.
public float Skew { get; set; }
Property Value
Warnings
Gets list of the warning messages describing non-critical faults appeared during generation.
public List<string> Warnings { get; }
Property Value
Methods
GetJson(bool)
Form JSON string with recognition results.
public string GetJson(bool isReadable = false)
Parameters
isReadable
bool
Determines whether json will be human readable.
Returns
Recognition results as JSON string.
GetKeywords()
Get keywords from pasport (Test mode. Works only for USA and MADAGASCAR passports).
public Dictionary<string, recognitionresult.linesresult=""> GetKeywords()
Returns
Dictionary<string, RecognitionResult.LinesResult>
Dictionary with keyword as a key and LinesResult as a value.
GetSpellCheckCorrectedText(SpellCheckLanguage, string)
Corrects text (replaces misspelled words).
public string GetSpellCheckCorrectedText(SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null)
Parameters
language
SpellCheckLanguage
Dictionary to use.
dictionaryPath
string
Optionally. Full path to the user dictionary (frequency dictionary). Dictionary file format: Plain text file in UTF-8 encoding. Word and Word Frequency are separated by space or tab.Per default, the word is expected in the first column and the frequency in the second column. Every word-frequency-pair in a separate line.A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r"), or a carriage return immediately followed by a line feed("\r\n"). Every word is expected to be in lower case.
Returns
Text with replaced words.
GetSpellCheckErrorList(SpellCheckLanguage, string)
Find the misspelled words with suggested spellings for a given input text.
public List<spellcheckerror> GetSpellCheckErrorList(SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null)
Parameters
language
SpellCheckLanguage
Dictionary to use.
dictionaryPath
string
Optionally. Full path to the user dictionary (frequency dictionary). Dictionary file format: Plain text file in UTF-8 encoding. Word and Word Frequency are separated by space or tab.Per default, the word is expected in the first column and the frequency in the second column. Every word-frequency-pair in a separate line.A line is defined as a sequence of characters followed by a line feed ("\n"), a carriage return ("\r"), or a carriage return immediately followed by a line feed("\r\n"). Every word is expected to be in lower case.
Returns
List<SpellCheckError>
A list of SpellCheckError object representing misspelled words with lists suggested correct spellings for the each misspelled word, and with the edit distance.
GetXml()
Form XML string with recognition results.
public string GetXml()
Returns
Recognition results as a string XML serialized.
Save(string, SaveFormat, bool, SpellCheckLanguage, string, string, PdfOptimizationMode)
Saves the document as the plain text, PDF or Microsoft Word Document.
public void Save(string fullFileName, SaveFormat saveFormat, bool applySpellingCorrection, SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)
Parameters
fullFileName
string
Filename with a path for saving recognition result in the selected format.
saveFormat
SaveFormat
Document format (Docx, Txt, Pdf, Xlsx, Rtf, Json, Xml).
applySpellingCorrection
bool
Set true to correct misspelled words in case you have such in your recognition result.
language
SpellCheckLanguage
Dictionary for spell check (optional).
dictionaryPath
string
Optionally. Full path to the user dictionary in .txt format. Format is [word - space - frequence(number)]. Example: the 23135851162\nthat 3400031103\n
embeddedFontPath
string
Optionally. Full path to the user font.
optimizePdf
PdfOptimizationMode
Reduce the PDF file size by lowering the quality of background images. By default, the original image quality is preserved.
Save(string, SaveFormat, string, PdfOptimizationMode)
Saves the document as the plain text, PDF or Microsoft Word Document.
public void Save(string fullFileName, SaveFormat saveFormat, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)
Parameters
fullFileName
string
Filename with a path for saving recognition result in the selected format.
saveFormat
SaveFormat
Document format (Docx, Txt, Pdf, Xlsx, Rtf, Json, Xml).
embeddedFontPath
string
Optionally. Full path to the user font.
optimizePdf
PdfOptimizationMode
Reduce the PDF file size by lowering the quality of background images. By default, the original image quality is preserved.
Save(MemoryStream, SaveFormat, bool, SpellCheckLanguage, string, string, PdfOptimizationMode)
Saves the document as the plain text, PDF or Microsoft Word Document.
public void Save(MemoryStream stream, SaveFormat saveFormat, bool applySpellingCorrection, SpellCheckLanguage language = SpellCheckLanguage.Eng, string dictionaryPath = null, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)
Parameters
stream
MemoryStream
MemoryStream for saving recognition result in the selected format.
saveFormat
SaveFormat
Document format (Docx, Txt, Pdf).
applySpellingCorrection
bool
Set true to correct misspelled words in case you have such in your recognition result.
language
SpellCheckLanguage
Dictionary for spell check (optional).
dictionaryPath
string
Optionally. Full path to the user dictionary in .txt format. Format is [word - space - frequence(number)]. Example: the 23135851162\nthat 3400031103\n
embeddedFontPath
string
Optionally. Full path to the user font.
optimizePdf
PdfOptimizationMode
Reduce the PDF file size by lowering the quality of background images. By default, the original image quality is preserved.
Save(MemoryStream, SaveFormat, string, PdfOptimizationMode)
Saves the document as the plain text, PDF or Microsoft Word Document.
public void Save(MemoryStream stream, SaveFormat saveFormat, string embeddedFontPath = null, PdfOptimizationMode optimizePdf = PdfOptimizationMode.MAXIMUM_QUALITY)
Parameters
stream
MemoryStream
MemoryStream for saving recognition result in the selected format.
saveFormat
SaveFormat
Document format (Docx, Txt, Pdf).
embeddedFontPath
string
Optionally. Full path to the user font.
optimizePdf
PdfOptimizationMode
Reduce the PDF file size by lowering the quality of background images. By default, the original image quality is preserved.
Operators
operator +(RecognitionResult, RecognitionResult)
To complete the full result from recognized fragments (lines).
public static RecognitionResult operator +(RecognitionResult main, RecognitionResult part)
Parameters
main
RecognitionResult
The object to which the right operand will be added.
part
RecognitionResult
Right operand.
Returns
Left operand. </string,></recognitionresult.linesresult></char[]></rectangle>