Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.23
LEADTOOLS OCR C DLL Help

Recognizing Document Pages

Show in webframe

Each zone on a page has a recognition module associated with it through the ZONEDATA.RecogModule member. This recognition module provides information about the type of information contained in the zone and how to recognize that data. Depending on the type of recognition module, there may be additional options available for use during recognition.

After recognition is complete, the recognized characters can be obtained and the recognition results can be saved to a file or to memory.

For more information refer to:

An Overview of Recognition Modules

Drawing Pages and Zones

Working with Pages

Working with Zones

OCR Plus

For example, if a zone is associated with a Multi-lingual Omnifont Recognition module (MOR), then other recognition options for this module can be set using L_DocSetMOROptions. To get the current MOR options, use L_DocGetMOROptions.

Similarly, if a zone is associated with a Hand Printed Numeral Recognition module (ICR-HNR), then other recognition options can be set using L_DocSetHandPrintOptions or retrieved using L_DocGetHandPrintOptions. If the zone is associated with an Optical Mark Recognition module (OMR), other recognition options can be set using L_DocSetOMROptions and retrieved using L_DocGetOMROptions.

Depending on the type of recognition module associated with a zone, it may be beneficial to trade-off between the accuracy of recognition and the speed of recognition. Using the L_DocSetRecognizeModuleTradeOff function you can tell the OCR engine to perform the most accurate recognition, the fastest recognition, or a balanced recognition. To get the current trade-off setting for the OCR engine, call L_DocGetRecognizeModuleTradeOff.

If the host PC has two processors or a hyper-threaded one, using the Parallel Recognition Mode can speed up the recognition process by allowing the two recognition engines to run in parallel. The Parallel Recognition Mode may be used when a zone is associated with any of the following recognition modules: RECOGMODULE_MTEXT_OMNIFONT, RECOGMODULE_OMNIFONT_FRX, or RECOGMODULE_OMNIFONT_PLUS3W. To determine whether the Parallel Recognition Mode is enabled, call L_DocIsParallelRecognitionEnabled. To enable or disable the Parallel Recognition Mode, call L_DocEnableParallelRecognition.

When all necessary recognition options have been set, the page(s) can be recognized by calling L_DocRecognize. To get information on the status of the recognition process during recognition, pass a valid pointer to a RECOGNIZESTATUSCALLBACK function to the L_DocRecognize function.

The collection of characters recognized for a specific page can be obtained using L_DocGetRecognizedCharacters. To add any characters to this collection of recognized characters, call L_DocSetRecognizedCharacters. When this collection of recognized characters is no longer needed, it should be freed by calling L_DocFreeRecognizedCharacters.

Once the characters for a specific page have been determined using L_DocGetRecognizedCharacters, L_DocGetRecognizedWords can be called to combine the recognized characters into words. To change the contents of the recognized words, change the set of recognized characters by calling L_DocSetRecognizedCharacters. To save the updated recognized characters to a file, call L_DocSaveResultsToFile. To save the results into memory, call L_DocSaveResultsToMemory. When the collection of recognized words is no longer needed, it should be freed by calling L_DocFreeRecognizedWords.

The recognition results can be saved to a file by calling L_DocSaveResultsToFile.  The type of material exported to a file, the method in which the material is stored and the file type in which it is stored can all be controlled using L_DocSetRecognitionResultOptions. To get the current recognition results settings, call L_DocGetRecognitionResultOptions.

Call L_DocGetSupportedEngineFormats to obtain a list of all supported native engine formats. Retrieve the friendly name for each of the retrieved formats by calling L_DocGetEngineFormatFriendlyName. Call L_DocFreeEngineFormats when the format list returned by the L_DocGetSupportedEngineFormats function is no longer L_DocFreeEngineFormats needed.

When calling L_DocSetRecognitionResultOptions, you will specify the document writer format, so to set the options for document writer format, call L_DocSetDocumentWriterOptions, also, to get the set options for the document writer format, call L_DocGetDocumentWriterOptions.

When saving recognition results to a file, you can use L_DocEnumOutputFileFormats to enumerate all available output file formats supported by the OCR engine. This function will report each file format to an ENUMOUTPUTFILEFORMATS callback function. To get specific information about a particular output file format, call L_DocGetTextFormatInfo.

The recognition results can also be saved to memory by calling L_DocSaveResultsToMemory. When the memory is no longer needed it should be freed by calling L_DocFreeMemoryResults.

To get or set special characters used in the recognition process, use L_DocGetSpecialChar and L_DocSetSpecialChar.

Finally, to get the status of the OCR engine at any time, use L_DocGetStatus.

For more information refer to Output Converter Formatting Properties.

OCR Professional

For example, if a zone is associated with a Multi-lingual Omnifont Recognition module (MOR), then other recognition options for this module can be set using L_Doc2SetMOROptions. To get the current MOR options, use L_Doc2GetMOROptions.

Similarly, if a zone is associated with a Hand Printed Numeral Recognition module (ICR-HNR), then other recognition options can be set using L_Doc2SetHandPrintOptions or retrieved using L_Doc2GetHandPrintOptions. If the zone is associated with an Optical Mark Recognition module (OMR), other recognition options can be set using L_Doc2SetOMROptions and retrieved using L_Doc2GetOMROptions.

For some general information about available recognition modules, refer to An Overview of Recognition Modules.

Depending on the type of recognition module associated with a zone, it may be beneficial to trade-off between the accuracy of recognition and the speed of recognition. Using the L_Doc2SetRecognizeModuleTradeOff function you can tell the OCR engine to perform the most accurate recognition, the fastest recognition, or a balanced recognition. To get the current trade-off setting for the OCR engine, call L_Doc2GetRecognizeModuleTradeOff.

To apply the pre-processing functions to enhance a document (rotate, invert, brighten, control the threshold or changing the binarization mode), call the L_Doc2GetPreProcessingOptions function to the get the current engine's pre-processing options. To update these options, call the L_Doc2SetPreProcessingOptions function. Notice that calling of L_Doc2SetPreProcessingOptions function should precede the calling of L_Doc2FindZones or L_Doc2Recognize functions because the pre-processing options affect the auto-zoning and recognition results.

When all necessary recognition options have been set, the page(s) can be recognized by calling L_Doc2Recognize. To get information on the status of the recognition process during recognition, pass a valid pointer to a RECOGNIZESTATUSCALLBACK function to the L_Doc2Recognize function.

After recognition is complete, the recognized characters can be obtained and the recognition results can be saved to a file or to memory.

The collection of characters recognized for a specific page can be obtained using L_Doc2GetRecognizedCharacters. To add any characters to this collection of recognized characters, call L_Doc2SetRecognizedCharacters. When this collection of recognized characters is no longer needed, it should be freed by calling L_Doc2FreeRecognizedCharacters.

L_Doc2GetRecognizedCharacters will fill color indexes in RECOGCHARS.nFGColorIndex and RECOGCHARS.nBGColorIndex, so to get the associated colors for these indexes, first get the colors table, and then get the color. To get the colors table, call L_Doc2GetRecognizedCharactersColors.

If you wish to get characters choices after a previous call to L_Doc2GetRecognizedCharacters you can call the L_Doc2GetCharacterChoices function and to free the allocated memory by this function you should call L_Doc2FreeCharacterChoices function.

Once the characters for a specific page have been determined using L_Doc2GetRecognizedCharacters, L_Doc2GetRecognizedWords can be called to combine the recognized characters into words. To change the contents of the recognized words, change the set of recognized characters by calling L_Doc2SetRecognizedCharacters. To save the updated recognized characters to a file, call L_Doc2SaveResultsToFile or L_Doc2SaveResultsToFile2. When the collection of recognized words is no longer needed, it should be freed by calling L_Doc2FreeRecognizedWords.

If you wish to get words suggestions after a previous call to L_Doc2GetRecognizedWords you can call the L_Doc2GetWordSuggestions function and to free the allocated memory by this function you should call L_Doc2FreeWordSuggestions function.

Use L_Doc2SaveResultsToFile2 when you want to save the recognition results to different formats using the same recognition results while maintaining quality. Use L_Doc2SaveResultsToFile when memory is a constraint (it uses less memory than L_Doc2SaveResultsToFile2). However, L_Doc2SaveResultsToFile requires OCR to be performed separately for each file format in order to maintain quality.

Call L_Doc2GetSupportedEngineFormats to obtain a list of all supported native engine formats. Retrieve the friendly name for each of the retrieved formats by calling L_Doc2GetEngineFormatFriendlyName. Call L_DocFreeEngineFormats when the format list returned by the L_Doc2GetSupportedEngineFormats function is no longer L_Doc2FreeEngineFormats needed.

For List of all supported native engine formats you can call L_Doc2GetSupportedEngineFormats and you can retrieve a friendly name for each of the retrieved formats by calling L_Doc2GetEngineFormatFriendlyName. call L_Doc2FreeEngineFormats when you no longer need formats list returned by the L_Doc2GetSupportedEngineFormats function.

The recognition results can be saved to a file by calling L_Doc2SaveResultsToFile or L_Doc2SaveResultsToFile2. The type of material exported to a file, the method in which the material is stored and the file type in which it is stored can all be controlled using L_Doc2SetRecognitionResultOptions. To get the current recognition results settings, call L_Doc2GetRecognitionResultOptions.

When calling L_Doc2SetRecognitionResultOptions, you will specify the document writer format, so to set the options for document writer format, call L_Doc2SetDocumentWriterOptions, also, to get the set options for the document writer format, call L_Doc2GetDocumentWriterOptions.

The OCR engine supports different settings for each output format. These settings will affect the output file. To get specific format settings, call L_Doc2GetOutputFormatSettings. Update the settings, then call L_Doc2SetOutputFormatSettings. Call L_Doc2SaveResultsToFile function to save the output results to a file.

When saving recognition results to a file, you can use L_Doc2EnumOutputFileFormats to enumerate all available output file formats supported by the OCR engine. This function will report each file format to an ENUMOUTPUTFILEFORMATS callback function. To get specific information about a particular output file format, call L_Doc2GetTextFormatInfo.

To get or set special characters used in the recognition process, use L_Doc2GetSpecialChar and L_Doc2SetSpecialChar.

Finally, to get the status of the OCR engine at any time, use L_Doc2GetStatus.

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.