Browse our Products

Aspose.OCR for .NET 23.9.0 - Release Notes

Deprecation warning

What was changed

KeySummaryCategory
OCRNET‑719The speed of batch recognition has been significantly increased (up to 2 times).Enhancement
OCRNET‑719Improved support for multi-threaded recognition.Enhancement

Public API changes and backwards compatibility

This section lists all public API changes introduced in Aspose.OCR for .NET 23.9.0 that may affect the code of existing applications.

Added public APIs:

No changes

Updated public APIs:

No changes

Removed public APIs:

No changes.

Changes in application logic

Multithreading support has been significantly redesigned. Now it works differently depending on the number of images in the recognition batch:

Recognizing one image

This scenario is applied to recognition of a single image or a single-page PDF. For example:

Aspose.OCR.AsposeOcr recognitionEngine = new Aspose.OCR.AsposeOcr();
// Add one image to OcrInput object
Aspose.OCR.OcrInput input = new Aspose.OCR.OcrInput(Aspose.OCR.InputType.SingleImage);
input.Add("source.png");
// Limit resource usage to 4 threads
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.ThreadsCount = 4;
// Recognize image
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input, recognitionSettings);
Console.WriteLine(results[0].RecognitionText);

The recognition behavior has not changed from previous versions. Aspose.OCR for the .NET will use all CPU cores/threads for recognizing the provided image (if ThreadsCount is not configured) or the number of threads specified in ThreadsCount (if set).

Recognizing multiple files/pages

This scenario is used for bulk recognition of several images or recognition of a multi-page document (PDF, DjVu). It is also applicable when processing files from a folder or ZIP archive. For example:

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");
input.Add("source3.jpg");
// Limit resource usage to 6 threads
Aspose.OCR.RecognitionSettings recognitionSettings = new Aspose.OCR.RecognitionSettings();
recognitionSettings.ThreadsCount = 6;
// Bulk recognition
List<Aspose.OCR.RecognitionResult> results = recognitionEngine.Recognize(input, recognitionSettings);
foreach(Aspose.OCR.RecognitionResult result in results)
{
	Console.WriteLine(result.RecognitionText);
}

Each image from the batch is processed in one separate thread. If more than one thread is available, images are recognized in parallel.

The number of images processed simultaneously cannot exceed the value of the ThreadsCount recognition setting or the total number of CPU threads (if ThreadsCount is not configured or exceeds the number of CPU threads).