ImageGear .NET
Recognition API and Multi-Threading

The Recognition API can be used in a multi-threaded application. However, it is generally the application's responsibility to ensure that the different recognition activities (e.g., pre-processing, decomposition, recognition, etc.) occur sequentially for any given image or page.

Multiple instances of the ImGearRecognition object are now supported in a single process. While all instances of this object will access the same underlying native Recognition engine, each instance operates on its own set of pages and documents. Each instance can use the shared global collection of Recognition settings if instantiated with the default constructor. This means that changing settings (e.g., ImGearRecOutputManager.Format) in one instance will affect all other instances using the global settings. To isolate the Recognition settings for each instance, use the overloaded constructor, ImGearRecognition(bool). This will force each instance to use its own collection of unique settings.

Using multiple instances of the ImGearRecognition object in separate threads enables the application to perform recognition activities on different images and pages in parallel. However, it is important to remember that for each page, the recognition process must occur sequentially, meaning that a page must first be imported and pre-processed before it can be recognized and exported. Also, access to the underlying formatted output module is synchronized, so only one instance can export to a formatted output document at a time.

No re-entrance is allowed within the same thread. This can occur when the API is firing an event. When the focus of control is in the application-defined event handler, no methods of the Recognition API can be called.

This section provides information about the following:

Memory Usage Best Practices

With the ability to open and recognize multiple images at once, it becomes the responsibility of the developer to ensure that the amount of memory being consumed by this process does not exceed the limitations of the system. The following points should always be considered when using the Recognition API, but especially when calling it within multiple threads or when large images are to be recognized:

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback