L_Doc2FindZones

#include "ltdoc2.h"

L_LTDOC2_API L_INT EXT_FUNCTION L_Doc2FindZones(hDoc, nPageIndex)

Finds all zones in the specific page.

Parameters

L_HDOC2 hDoc

Handle to the OCR document.

L_INT nPageIndex

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

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

The L_Doc2FindZones function 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 page area of the image. It finds text or graphics blocks within the page area, builds an OCR zone list and then connects it to the specified page.

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

To retrieve the number of OCR zones list and number of user zones, use the L_Doc2GetZoneCount / L_Doc2GetZoneCountExt function.

Zones can be deleted from this list using the L_Doc2RemoveZone / L_Doc2RemoveZoneExt function. You can get the zone parameters by calling the L_Doc2GetZone / L_Doc2GetZoneExt function. After modifying some zone attributes, use the L_Doc2UpdateZone / L_Doc2UpdateZoneExt function to apply the changes to the zone.

When working with zones from the OCR zone list, the following members cannot be updated:

This function finds the zone coordinates and the type of the zone.

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

New zones located by this function always have the DOC2_FILL_DEFAULT and DOC2_RECOGMODULE_AUTO values in their FillMethod and RecogModule fields, respectively. The "meaning" of the DOC2_FILL_DEFAULT filling method can be specified with the L_Doc2SetFillMethod / L_Doc2SetFillMethodExt function. There is no corresponding function for specifying the default recognition module.

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

✎ NOTE

User words and dictionaries are no longer supported in the LEADTOOLS OCR Module - OmniPage Engine.

The L_Doc2FindDefaultFillMethod / L_Doc2FindDefaultFillMethodExt function can be used when you don't know the type of page to be processed.

To set Auto Zone options, call the L_Doc2SetZoneOptions / L_Doc2SetZoneOptionsExt function.

To get Auto Zone options, call the L_Doc2GetZoneOptions / L_Doc2GetZoneOptionsExt function.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT Doc2FindZonesExample(L_HDOC2 hDoc,L_INT nPageIndex) 
{ 
   L_INT nRet; 
   AUTOZONEOPTS2 ZoneOpts; 
 
   ZeroMemory(&ZoneOpts, sizeof(AUTOZONEOPTS2)); 
   nRet = L_Doc2GetZoneOptions (hDoc, &ZoneOpts, sizeof(AUTOZONEOPTS2)); 
   if(nRet != SUCCESS) 
      return nRet; 
   ZoneOpts.bEnableForceSingleColumn = TRUE; 
   ZoneOpts.bDetectNonGridedTables = TRUE; 
   nRet = L_Doc2SetZoneOptions (hDoc, &ZoneOpts); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = L_Doc2FindZones(hDoc, nPageIndex); 
   if (nRet == SUCCESS) 
      MessageBox(NULL, TEXT("The engine finds all available zones in the specified page."), TEXT("Notice!"), MB_OK); 
 
   L_INT nOcrZoneCount=0; 
   nRet = L_Doc2GetZoneCount(hDoc, nPageIndex, &nOcrZoneCount); 
   if (nRet != SUCCESS) 
      return nRet; 
 
   L_TCHAR szBuffer[100]; 
   memset(szBuffer, 0, sizeof(szBuffer)); 
   wsprintf(szBuffer, TEXT("Total zones in the specified page = %d\n"), nOcrZoneCount); 
   MessageBox(NULL, szBuffer, TEXT("Zones Count!"), MB_OK); 
   return SUCCESS; 
} 
Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS OCR Module - OmniPage Engine C API Help