FineReader Engines Pool - Multithreading Sample (Windows)

FineReader Engine
10, 11, 12
Code Samples Collection
Programming Aspects
Recognition, OCR: Speed & Quality
C#, Java
image: icon_batchprocessingrecognition.gif

This sample on the one hand provides a complete reusable solution for a pool of Engines in a multi-threaded application, and on the other hand demonstrates the gain in speed when using multiprocessing.


Precompiled Sample 'FineReader Engines Pool'

The sample processes images from a predefined folder (SampleImages\MultiProcessingRecognition). It creates a pool of Engine objects, which recognize images from this folder in parallel. The default number of threads equals the number of CPU cores. You can reduce it to compare the difference in speed.

To run the sample, click Go.

The sample uses the following procedure for initialization of a processor:

  • Use the OutprocLoader object to load the Engine object as an out-of-process server:
    1. Create a new OutprocLoader for each thread you want to start.
    2. Create an instance of Engine object using the GetEngineObject method (version 11) or the InitializeEngine method (version 12) of the OutprocLoader object.
  • For each worker thread:
    1. Get an Engine from the pool.
    2. [optional] Load a predefined profile for your scenario using the LoadPredefinedProfile method of the Engine object.
    3. Call the CreateFRDocument method of the Engine object to create the FRDocument object.
    4. Add images to the document using the AddImageFile method of the FRDocument object.
    5. [optional] Create the DocumentProcessingParams object and set the page processing parameters (for preprocessing, analysis, and recognition) and document synthesis parameters.
    6. Call the Process method of the FRDocument object.
    7. [optional] Create an export parameter object of the type you need. The type of this object depends on the format of the output file you would like to use (FileExportFormatEnum). The default object values are the ones used most frequently, but you may set the export parameters as you like.
    8. Call the Export method of the FRDocument object to save the document to a file of the specified format.
    9. Close the FRDocument object using the Close method.
    10. Release the Engine back to the pool.

Back To:

This website uses cookies which enable you to see pages or use other functions of our websites. You can turn off such cookies in your browser’s settings. If you continue to use these pages, you consent to the use of cookies.