Recognition
Reading text from any content in Aspose.OCR for .NET is as easy as calling a universal Aspose.OCR.AsposeOcr.Recognize
method.
This method takes OcrInput
object and optional recognition settings.
Recognition results are returned as a list of Aspose.OCR.RecognitionResult
objects, that allow you to perform advanced manipulations with recognition results: automatically correct spelling, get image regions and save results in various formats.
Upgrading from previous versions
Starting with Aspose.OCR for .NET 23.3.1, this method replaces RecognizeImage
, RecognizePdf
, RecognizeTiff
, RecognizeDjvu
, RecognizeImageFromUri
, RecognizeMultipleImages
, and RecognizeImageFromBase64
recognition methods.
Example
The following code example shows how to extract text from multiple images:
Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add images to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source1.png");
input.Add("source2.jpg");
// Set recognition language
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.Language = Aspose.OCR.Language.Ukr;
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input, recognitionSettings);
foreach(Aspose.OCR.RecognitionResult result in results)
{
Console.WriteLine(result.RecognitionText);
}