The AutoZone(OcrZoneParser,OcrZoneFillMethod,LogicalUnit,OcrProgressCallback) Method is available as an add-on to the LEADTOOLS Document and Medical Imaging toolkits.
- zoneParser
- The parser used for auto zoning.
Note: This parameter will always contain OcrZoneParser.Default when using the LEADTOOLS OCR Advantage Engine.
- fillMethod
- The fill method used in the zones found.
- zonesUnit
- The units for the bounding rectangle of the new zones.
- callback
- Optional callback to show operation progress.
Visual Basic (Declaration) | |
---|---|
Overloads Sub AutoZone( _ ByVal zoneParser As OcrZoneParser, _ ByVal fillMethod As OcrZoneFillMethod, _ ByVal zonesUnit As LogicalUnit, _ ByVal callback As OcrProgressCallback _ ) |
Visual Basic (Usage) | Copy Code |
---|---|
Dim instance As IOcrPage Dim zoneParser As OcrZoneParser Dim fillMethod As OcrZoneFillMethod Dim zonesUnit As LogicalUnit Dim callback As OcrProgressCallback instance.AutoZone(zoneParser, fillMethod, zonesUnit, callback) |
C# | |
---|---|
void AutoZone( OcrZoneParser zoneParser, OcrZoneFillMethod fillMethod, LogicalUnit zonesUnit, OcrProgressCallback callback ) |
C++/CLI | |
---|---|
void AutoZone( OcrZoneParser zoneParser, OcrZoneFillMethod fillMethod, LogicalUnit zonesUnit, OcrProgressCallback^ callback ) |
Parameters
- zoneParser
- The parser used for auto zoning.
Note: This parameter will always contain OcrZoneParser.Default when using the LEADTOOLS OCR Advantage Engine.
- fillMethod
- The fill method used in the zones found.
- zonesUnit
- The units for the bounding rectangle of the new zones.
- callback
- Optional callback to show operation progress.
This method differs from AutoZone as follows:
- The new zones found by this method will always have the OcrZone.FillMethod value set to fillMethod instead of OcrZoneFillMethod.Default.
- The new zones found will have their bounding rectangle (the value of the OcrZone.Bounds in the units specified by zonesUnit instead of LogicalUnit.Pixels. For example, you can specify LogicalUnit.Inch and the zones coordinates will be in inches using the page DPI value (DpiX and DpiY) to calculate the values.
You can use the OcrProgressCallback to show the operation progress or to abort it. For more information and an example, refer to OcrProgressCallback.
The zones found by this method are added to the Zones collection of this page. Any previously added zones will be removed from Zones first.
This method finds the zone coordinates (OcrZone.Bounds) and type (OcrZone.ZoneType). The type of the zone determines the role of the zone in the page layout and can be classified into three different groups:
- The flowed text zone types: OcrZoneType.Text, OcrZoneType.Column, OcrZoneType.Header, OcrZoneType.Footer, OcrZoneType.Caption, OcrZoneType.Title, OcrZoneType.VerticalText, OcrZoneType.LeftRotatedText, OcrZoneType.RightRotatedText and OcrZoneType.Other. These types mean that the zone contains textual information without a table type structure inside (it is flowed text). These types listed above are considered the same, they will not be differentiated from each other during the later processing stages.
Note: Only OcrZoneType.Text is currently supported for the LEADTOOLS OCR Advantage Engine.
- The OcrZoneType.Table type. A zone having this type means that the zone is detected as containing a table, i.e. with columns, with or without a grid. Such zones will be handled differently from those of flowed text type zones.
- The OcrZoneType.Graphic type means a zone contains graphics, i.e. this zone will not be recognized at all. The only reason to have such a zone is to save or export the image inside the zone area.
The new zones found by this method will always have the OcrZone.FillMethod and OcrZone.RecognitionModule set to fillMethod and OcrZoneRecognitionModule.Auto respectively. In order to override this automatic fill method and recognition module, you must update each zone in Zones by getting the zone with the Leadtools.Forms.Ocr.IOcrZoneCollection getter, update and set it back with the setter. You can get the number of zones found by this method with the Zones.Count property.
New zones created by this method will always have an empty string in its OcrZone.UserDictionarySectionName property which means the use of the default section of the User dictionary. For more information, refer to IOcrUserDictionary.
To update the zones of a page with fill method set to OcrZoneFillMethod.Default, use UpdateFillMethod.
To detect the global fill method of a page, use DetectFillMethod.
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 or or RecognizeText methods 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 or or RecognizeText.
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.
Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7