LEADTOOLS OCR (Leadtools.Forms.Ocr assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
Recognize Method
See Also 
Leadtools.Forms.Ocr Namespace > IOcrPage Interface : Recognize Method



callback
Optional callback to show operation progress.

The Recognize Method is available as an add-on to the LEADTOOLS Document and Medical Imaging toolkits.

callback
Optional callback to show operation progress.
Recognizes the OCR data found on this IOcrPage.

Syntax

Visual Basic (Declaration) 
Sub Recognize( _
   ByVal callback As OcrProgressCallback _
) 
Visual Basic (Usage)Copy Code
Dim instance As IOcrPage
Dim callback As OcrProgressCallback
 
instance.Recognize(callback)
C# 
void Recognize( 
   OcrProgressCallback callback
)
C++/CLI 
void Recognize( 
   OcrProgressCallback^ callback
) 

Parameters

callback
Optional callback to show operation progress.

Example

For an example, refer to IOcrPage.

Remarks

Perform image pre-processing by calling the IOcrPage.AutoPreprocess method prior to calling IOcrPage.Recognize or IOcrPage.RecognizeText.

If this page is not a black/white one (i.e. it contains a gray-scale or a 24-bit color image), then an implicit secondary image conversion step will be performed automatically to convert the image to a B/W one.

IOcrPage.Recognize utilizes the zone information to activate the appropriate recognition module on every zone Zones property. Each recognition module recognizes the page parts assigned to it in the zones.

If the zone collection Zones of this IOcrPage is empty (i.e. there are no zones defined), then the page-layout decomposition process will be activated automatically in order to create a zone list for the image, before recognition. Hence, AutoZone will be implicitly called.

Note: If this IOcrPage is an empty page, in other words, when the OCR engine performs automatic page decomposing with the AutoZone method and could not find any zones in it, the IOcrPage.Recognize method will fail with an exception. It is recommended you call AutoZone and then check if there is at least one zone found by the engine (using Zones.Count). If the count is zero, do not call IOcrPage.Recognize.

If a recognition module is not able to recognize an object (i.e. character, or checkmark etc.), this object will be marked as a rejected one. It will become marked by a rejection symbol during conversion to the final output document. Note that IOcrDocumentManager.RejectionSymbol can be set to specify the rejection symbol used in the final document.

This method uses the checking subsystem (IOcrSpellCheckManager) to either flag suspicious characters or words, or to allow auto-correction during the recognition process.

After having recognized all the zones on the page, IOcrPage.Recognize stores the necessary information about the recognized characters internally. You can later use the IOcrDocument that owns this page to save the data to a file or memory using the many formats supported by this IOcrEngine such as Text, PDF or Microsoft Word.

To recognize a multi-page document you can iterate through the pages of the IOcrDocument object and call IOcrPage.Recognize on each page. You can The IOcrPageCollection.Recognize method will also loop through the pages in the IOcrPage in the order they are stored in the engine and call IOcrPage.Recognize once for each page. If you save the result IOcrDocument to a disk file, you will get a document file containing as many pages as the number of items in the IOcrDocument.Pages collection.

You can use the OcrProgressCallback to show the operation progress or to abort it. For more information and an example, refer to OcrProgressCallback.

Since the format of the recognized data file is not documented, you can use GetRecognizedCharacters and SetRecognizedCharacters to examine or modify the data. Any changes you make to the recognition data will be saved in the result document when you save IOcrDocument.

After the page is successfully recognized, the value of the IsRecognized property should be true.

Use Unrecognize to clear the recognition data stored in a page.

If you are only interested in the recognition data as text (in other words, you are not planning to save the result document to disk), then you can use the RecognizeText method and obtain the result data as a string. A common technique in OCR is to perform form processing by adding a zone manually around the required "field" and calling RecognizeText to get the string value of the field.

Since the recognition algorithm may use the checking subsystem, you must set up the IOcrSpellCheckManager prior to calling IOcrPage.Recognize. Checking recognized zone contents may consist of any combination of the following:

To get the accuracy and timing data of the latest successful recognition process use GetLastStatistic after calling IOcrPage.Recognize.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Recognize requires an OCR module license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features