Browse our Products
Aspose.OCR for .NET 23.9.0 - Release Notes
This article contains a summary of recent changes, enhancements and bug fixes in Aspose.OCR for .NET 23.9.0 (September 2023) release.
GPU version: 23.9.0
Deprecation warning
The release 23.3.1 introduced a slimmer, faster and more straightforward API. All of your existing code will continue to work and you can even make minor updates to it, but be aware that all deprecated elements are scheduled to be removed in release 23.11.0 (November 2023) in favor of the new API.
Time to deprecation: 1 months left.
What was changed
Key | Summary | Category |
---|---|---|
OCRNET‑719 | The speed of batch recognition has been significantly increased (up to 2 times). | Enhancement |
OCRNET‑719 | Improved 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).
Parallel processing increased the batch recognition speed by approximately 100% (twice as fast) compared to the previously used approach.
Recognition of a single image is unaffected.