←Select platform

OcrCharacter Structure

Summary

Represents recognized character data.

Syntax

C#
VB
Java
Objective-C
WinRT C#
C++
[SerializableAttribute()] 
public struct OcrCharacter 
<SerializableAttribute()> 
Public Structure OcrCharacter  
   Inherits System.ValueType 
[SerializableAttribute()] 
public class OcrCharacter 
@interface LTOcrCharacter : NSObject <NSCopying> 
public class OcrCharacter 
JAVASCRIPT_NOSTRUCTS 
[SerializableAttribute()] 
public value class OcrCharacter : public System.ValueType  

Remarks

To get the recognized characters of a page, call IOcrPage.GetRecognizedCharacters after IOcrPage.Recognize.

To update the recognized characters of a page, call IOcrPage.SetRecognizedCharacters before calling IOcrDocument.Save, or IOcrDocument.SaveAsync, IOcrDocument.SaveXml or or IOcrDocument.SaveXmlAsync.

IOcrPageCharacters implements the standard IList<T>, ICollection<T> and IEnumerable<T> interfaces with items of type IOcrZoneCharacters. Each item in the IOcrPageCharacters contains a collection of the character collections of the zones.

The IOcrZoneCharacters interface contains a collection of the characters for a particular zone.

IOcrZoneCharacters also implements IList<T>, ICollection<T> and IEnumerable<T> interfaces but with items of type OcrCharacter. Each item in the IOcrZoneCharacters contains a collection of the characters of the zone.

The IOcrPageCharacters interface also contains the IOcrPageCharacters.UpdateWord method that allow to modify the OCR recognition results by updating or deleting the words before optionally saving the results to the final output document.

For example, if you are interested in iterating through the characters of the 2nd zone in the page, you can do the following:

C#
// Get the page characters  
IOcrPageCharacters pageCharacters = ocrPage.GetRecognizedCharacters();  
 
// Get the 2nd zone characters. Note, index is zero-based so 2nd zone is index 1  
// You can also iterate through the pageCharacters collection and fine the IOcrZoneCharacters item with ZoneIndex = 1  
IOcrZoneCharacters zoneCharacters = pageCharacters.FindZoneCharacters(1);  
 
// Loop through the characters 
foreach(OcrCharacter ocrCharacter in zoneCharacters) 
{ 
   // Do something with ocrCharacter 
} 

OcrCharacter is the most detailed information available about the recognized characters.

Touching characters, those whose shapes are physically joined in the page passed to the OCR engine, will result in a separate OcrCharacter structure for each recognized character within the block. However, the coordinate property of these characters (Bounds) will have identical coordinates defining a rectangle boundary for the character block. The order of the OcrCharacter structures representing a character block gives the order of the touching characters on the original document. This means the coordinates do not give information on the order of characters inside a boundary block.

To create an OcrCharacter object with all values initialized to default values, use OcrTypeManager.CreateDefaultOcrCharacter. This is a shortcut for languages that do not automatically initialize all the members of a structure, such as JavaScript.

Example

For an example, refer to IOcrPage.GetRecognizedCharacters.

Requirements

Target Platforms

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Ocr Assembly