Multi-Processing Recognition - Code Sample (Windows)

Language:
EN
Product-Line:
FineReader Engine
Version:
10, 11, 12
Platform:
Windows
KB-Type:
Code Samples Collection
KB-Topic:
Recognition
Category:
Recognition, OCR: Speed & Quality
Coding:
C#
Image:
image: icon_multiprocessingrecognition.gif

This sample shows the gain in speed when processing a multi-page document in several recognition processes as compared to processing the same document in a single process. The sample uses methods of the FRDocument object for processing. Parallel processing is used for image opening, preprocessing, layout analysis, recognition and export stages. Only document synthesis is performed sequentially, since during synthesis all the information about the document should be accessible to the working process. After all pages have been processed, the user can access the result of processing of the whole document.

Compare this sample with the Batch-Processing Recognition sample.

Precompiled Sample 'Multi-processing Recognition'

Screenshot made with a Laptop (2012) Quad i7-3720QM, 2,6 GHz, Windows 7, 16 GB RAM, 64 bit;
FineReader Engine 10 R7 - Std. sample files that are included

Precompiled Sample 'Batch-Processing Recognition'

Screenshot made with a Laptop (2009) Core2 Duo T9800, 2,9 GHz, Windows 7, 4 GB RAM 32 bit;
FineReader Engine 10 R1 - Std. sample files that are included
Production machines are faster and have more cores =)

This sample shows the gain in speed when using multiprocessing recognition.

Description

The sample processes document images from the specified folder and, if necessary, saves them in PDF format. The sample compares the speed of processing in one thread and in parallel threads. The result of comparison is shown on a diagram.

To view how it works:

  1. Select the folder with images to process.
  2. Specify recognition languages of the processing documents.
  3. Specify the number of CPU cores to test on. The default number of CPU cores equals the maximum available number. You can reduce it to compare the difference in speed. The test for one CPU core is performed automatically during processing.
  4. Specify, whether to save recognized text. If the results are saved, the duration of all processing operations (analysis, recognition, synthesis, and export) is measured. Otherwise, only the time of analysis and recognition is measured.
  5. To run the sample, click Start.

The sample uses the following procedure of multiprocessing recognition:

  • Create the Engine object using the GetEngineObject function (version 11) or InitializeEngine function (version 12).
  • [optional] Load a predefined profile for your scenario using the LoadPredefinedProfile method of the Engine object.
  • Call the LoadModule method of the Engine object to load the FineReader Engine Processor module (FREM_FREngineProcessor).
  • Use the MultiProcessingParams property of the Engine object to specify multiprocessing settings.
  • Call the CreateFRDocument method of the Engine object to create the FRDocument object.
  • [optional] If you want to show the progress of processing, you can use the OnProgress method of the IFRDocumentEvents interface and the PageProcessingStageEnum constants.
  • Use the AddImageFile method to add pages to the document.
  • Call the Process method of the FRDocument object with the PerformSynthesis property of the DocumentProcessingParams object set to false.
  • Call the Synthesize method of the FRDocument object.
  • Call the Export method of the FRDocument object to save the document to a file of the specified format.
  • Close the FRDocument object using the Close method.
  • Unload FineReader Engine — use the DeinitializeEngine function.



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.