L_OcrAutoRecognizeManager_RunJob

#include "ltocr.h"

L_LTOCR_API L_INT EXT_FUNCTION L_OcrAutoRecognizeManager_RunJob(autoRecognizeManager, autoRecognizeJob)

Runs a job.

Parameters

L_OcrAutoRecognizeManager autoRecognizeManager

Handle to the OCR engine auto recognize manager.

L_OcrAutoRecognizeJob autoRecognizeJob

Handle to the OCR engine auto recognize job.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

If you call this method from the same thread that created L_OcrAutoRecognizeManager, then the current thread will block till this method returns. To run a job asynchronously, use L_OcrAutoRecognizeManager_RunJobAsync.

When this method returns you can call L_OcrAutoRecognizeJob_GetErrors to get any errors that might occurred during the recognition process.

To use this method, initialize a new L_OcrAutoRecognizeJobData structure with the job's parameters (input image file name, pages, output document format, output document name, optional zones file name, etc.), then use L_OcrAutoRecognizeManager_CreateJob to create the L_OcrAutoRecognizeJob handle passed as job handle to this method. Finally, call L_OcrAutoRecognizeManager_RunJob passing the L_OcrAutoRecognizeJob handle.

This method will perform the following operations:

  1. The L_OcrAutoRecognizeRunJobCallback callback will be fired to indicate that job just started.
  2. Creates one ore more L_OcrPage. The number of created OCR pages conforms to the following formula: MIN(8, maximum CPUs/cores), so if you have more than 8 cores on your machine only 8 threads will be created but if you have less that 8 cores then that number will be used to determine the number of threads to be created to participate in the recognition process. Also the internal created OCR document will be created as disk-based.
  3. Loops through the pages specified in L_OcrAutoRecognizeJobData.FirstPageNumber and in L_OcrAutoRecognizeJobData.LastPageNumber in L_OcrAutoRecognizeJobData.ImageFileName and for each page:
    1. The page is created using L_OcrPage_FromBitmap after we load the file into BITMAPHANDLE.
    2. If L_OcrAutoRecognizeJobData.ZonesFileName contains a valid multipage zone file name and has an entry for the current page, then the zones are loaded with L_OcrPage_LoadZonesFile and applied to the page. If L_OcrAutoRecognizeJobData.ZonesFileName is a NULL or is empty string or it does not contain an equivalent page number, auto-decomposing of the page is performed instead with L_OcrPage_AutoZone.
    3. L_OcrPage_Recognize is called to get the OCR data of the page.
    4. The page is added to the internal OCR document using L_OcrDocument_AddPage.

  4. When all pages are processed they will be saved to result file name specified in L_OcrAutoRecognizeJobData.DocumentFileName using the format specified L_OcrAutoRecognizeJobData.Format.

  5. All OCR documents and temporary files are deleted.
  6. The L_OcrAutoRecognizeRunJobCallback callback will be fired to indicate that the job has completed or aborted.
  7. You can use the L_OcrAutoRecognizeJobOperationCallback to get information regarding the current operation being performed. For more information and an example, refer to L_OcrAutoRecognizeManager_SetJobOperationCallback.

The L_OcrAutoRecognizeManager also has some options that you can control, For more information about these options, refer to L_OcrAutoRecognizeManager_GetOptions and L_OcrAutoRecognizeManager_SetOptions.

Required DLLs and Libraries

Help Version 20.0.2020.4.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - LEAD Engine C API Help