L_DocFindZones

#include "ltdoc.h"

L_INT EXT_FUNCTION L_DocFindZones(hDoc, nPageIndex, pRect)

L_HDOC hDoc;

/* handle to the OCR document */

L_INT nPageIndex;

/* page index */

LPRECT pRect;

/* zones Area */

Finds all zones in the specified are of the specified page.

Parameter

Description

hDoc

Handle to the OCR document.

nPageIndex

Specifies the index of the page to search. This is a zero-based index.

pRect

Pointer to RECT structure which specifies the area in which to search for zones. Pass NULL to search the entire page area.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

L_DocFindZones is used for parsing the specified page (also called: auto-zoning), i.e. it analyzes the structure of the page layout and locates blocks for further processing.

The function performs the analysis within the specified area of the image. It finds text or graphics blocks within the specified area, builds a zone list and then connects it to the specified page.

Zones found by this function are entered in a sequential list, called the zone list, which is attached to the specified page. When this function is called, any previously inserted zones are deleted from this list.

L_DocGetZoneCount can be used to retrieve the number of zones in the zone list. Zones can be deleted from this list by the L_DocRemoveZone function. You can get the zone parameters by calling L_DocGetZone. After modifying some zone attributes, use L_DocUpdateZone to apply the changes to the zone.

This function finds the zone coordinates and the type of the zone. The zone type determines the role of the zone in the image layout and can be classified into three different groups:

Group 1: flowed text types:

ZONE_FLOWTEXT, ZONE_COLUMN, ZONE_HEADER, ZONE_FOOTER, ZONE_CAPTION, ZONE_TITLE, ZONE_OTHER

These zone types mean that the zone contains textual information without a table type structure (it is flowed text). The types listed above are considered the same. They are differentiated from each other during the later processing stages.

Group 2: table text type:

ZONE_TABLE

This type means that the zone is detected as containing a table, i.e. with columns, with or without a grid. Such zones are handled differently from those of flowed text type zones.

Group 3: graphic zones:

ZONE_GRAPHIC, ZONE_SGRAPHIC

These zones contain graphics, i.e. this zone will not be recognized at all. These zones exist only to allow saving or export of the image inside the zone area.

New zones created by this function always take the value ZONE_CHAR_FILTER_DEFAULT, meaning that the zone will take on the global filter setting (which is by default ZONE_CHAR_FILTER_DEFAULT to have no filtering).

New zones located by this function always have the FILL_DEFAULT and RECOGMODULE_AUTO values in their FillMethod and RecogModule fields, respectively. The "meaning" of the FILL_DEFAULT filling method can be specified with L_DocSetFillMethod.On the other hand, there is no similar function for specifying the default recognition module.

New zones created by this function always have empty strings in their ZONEDATA.szSection member, which specifies the use of the default section of any enabled User dictionary.

L_DocFindDefaultFillMethod can be used when you don't know the type of page to be processed.

To set Auto Zones options, call L_DocSetZoneOptions.

To get Auto Zones options, call L_DocGetZoneOptions.

Required DLLs and Libraries

LTDOC

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

L_DocAddZone, L_DocGetZoneCount, L_DocGetZone, L_DocUpdateZone, L_DocRemoveZone, L_DocImportZones, L_DocExportZones, L_DocSetZoneOptions, L_DocGetZoneOptions

Topics:

OCR Functions: Zones

 

Working with Zones

Example

void TestAutoZoneFunc(L_HDOC hDoc, L_INT nPageIndex)
{
   AUTOZONEOPTS ZoneOpts;

   memset(&ZoneOpts, 0, sizeof(AUTOZONEOPTS));
   L_DocGetZoneOptions (hDoc, &ZoneOpts, sizeof(AUTOZONEOPTS));
   ZoneOpts.bEnableForceSingleColumn = TRUE;
   ZoneOpts.bVisibleGridLines = TRUE;
   L_DocSetZoneOptions (hDoc, &ZoneOpts);

   L_INT nRet = L_DocFindZones(hDoc, nPageIndex, NULL);
   if (nRet == SUCCESS)
      MessageBox(NULL, TEXT("The engine finds all available zones in the specified page."), TEXT("Notice!"), MB_OK);
}