L_OcrZone

struct L_OcrZone 
{ 
   L_UINT StructSize; 
   L_UINT Id; 
   L_TCHAR Name[80]; 
   L_RECT Bounds; 
   L_OcrZoneType ZoneType; 
   L_OcrZoneCharacterFilters CharacterFilters; 
   L_OcrLanguage Language; 
   L_BOOL IsEngineZone; 
   L_COLORREF ForeColor; // for future use, the main fore color of the zone 
   L_COLORREF BackColor; // for future use, the main back color of the zone 
   L_UINT ViewPerspective; // TOP_LEFT, BOTTOM_LEFT, ... etc 
   L_OcrTextDirection TextDirection; 
   L_OcrTextStyle TextStyle; // Only available when ZoneType is L_OcrZoneType_Text 
   L_FLOAT FontRatio; // 1.0 is average font size of the document 
   L_UCHAR EngineData[256]; // for internal use 
}; 
typedef struct L_OcrZone L_OcrZone; 

Represents a rectangular area on a page containing a feature of interest to the user.

Member Description
StructSize Structure size. It should be equal to sizeof(L_OcrZone).
Id Gets the zone ID.
Name Gets or sets the optional zone name.
Bounds Gets or sets the coordinates of the zone in bitmap coordinates.
ZoneType Gets or sets the zone type. For a list of possible values, refer to L_OcrZoneType.
CharacterFilters Gets or sets the character set filter for the zone. For a list of possible values, refer to L_OcrZoneCharacterFilters.
Language Gets or sets the zone language. For a list of possible values, refer to L_OcrLanguage.
IsEngineZone Gets or sets a value that indicate whether this is an engine zone.
ForeColor Gets or sets the foreground color of zone.
BackColor Gets or sets the background color of zone.
ViewPerspective Gets or sets a value that determines the orientation and rotation of the zone.
TextDirection Gets or sets a value that determines the text direction of the zone.
TextStyle Gets or sets a value that determines the text style of the zone.
FontRatio Gets or sets a value that determines the font ratio of the zone.
EngineData This member is for internal use.

Comments

The L_OcrZone structure contains all the necessary information for describing a zone. A zone is a rectangular area on an image containing a feature of interest to the user. The image data covered by each zone is handled and processed (typically recognized) separately.

Variety of functions were provided to do different kinds of operations to the OCR page zones list, see list of these functions at the bottom of this page.

Zones can be divided into two basic categories: whether a zone is to be recognized or whether it should be treated as graphic. Zones containing text information can be considered to be either of the flowing type or of a table type. This basic classification of zones helps the OCR engine handle text information correctly.

Use the CharacterFilters member to modify the set of valid characters for recognition of text zone. Specifying the character set correctly is a recognition accuracy issue.

Construct the zones of a page automatically using L_OcrPage.AutoZone. You must call this method and finish any modification you might have to the zones before calling L_OcrPage_Recognize.

Note that since L_OcrZone is a structure (value type), use the setter. The following code snippet illustrates how to change the zone type of the 4th zone in an ocrPage:

// Remember, the index is zero-based, so 4th zone has an index of 3   
L_OcrZone zone;   
zone.StructSize = sizeof(L_OcrZone);   
L_OcrPage_GetZoneAt(ocrPage, 3, &zone);   
// Prevent this zone from being recognized   
zone.ZoneType = L_OcrZoneType_Graphic;   
L_OcrPage_SetZoneAt(ocrPage, 3, &zone);   

When adding or updating a zone directly initialize the L_OcrZone.Bounds, L_OcrZone.CharacterFilters and the L_OcrZone.ZoneType members of the zone, since they will not take on their default values.

Do not modify the OcrZone.Id property. When adding zones, leave this value to the default of 0.

The preferred method of updating a zone is as illustrated in the code snippet above, first get the zone of interest, update it and set it back into the page.

LEADTOOLS Advantage OCR for C API also supports OMR (Optical Mark Recognition). For more information, refer to Using OMR in LEADTOOLS C API OCR.

If the zone is a table, the you can use L_OcrPage_GetZoneCells and L_OcrPage_SetZoneCells to get information and manipulate the cells properties.

To create an L_OcrZone object with all values initialized to default values, use L_OcrZone_Default method.

This structure is used with the following functions:

L_OcrPage_InsertZone

L_OcrPage_AddZone

L_OcrPage_IndexOfZone

L_OcrPage_GetZoneAt

L_OcrPage_SetZoneAt

L_OcrPage_RemoveZone

L_OcrZone_Default

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