Leadtools.Forms.Ocr Namespace : IOcrZoneCollection Interface |
public interface IOcrZoneCollection : System.Collections.Generic.ICollection<OcrZone>, System.Collections.Generic.IEnumerable<OcrZone>, System.Collections.Generic.IList<OcrZone>, System.Collections.IEnumerable
'Declaration Public Interface IOcrZoneCollection Inherits System.Collections.Generic.ICollection(Of OcrZone), System.Collections.Generic.IEnumerable(Of OcrZone), System.Collections.Generic.IList(Of OcrZone), System.Collections.IEnumerable
'Usage Dim instance As IOcrZoneCollection
public interface IOcrZoneCollection : System.Collections.Generic.ICollection<OcrZone>, Windows.Foundation.Collections.IIterable //In WinRT the IEnumerableinterface is replaced by IIterable <OcrZone>, Windows.Foundation.Collections.IVector //In WinRT the IListinterface is replaced by IVector <OcrZone>, System.Collections.IEnumerable
function Leadtools.Forms.Ocr.IOcrZoneCollection() System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable
public interface class IOcrZoneCollection : public System.Collections.Generic.ICollection<OcrZone>, System.Collections.Generic.IEnumerable<OcrZone>, System.Collections.Generic.IList<OcrZone>, System.Collections.IEnumerable
IOcrZoneCollection holds the zones currently added into an OCR page. You can access the instance of the IOcrZoneCollection used by a IOcrPage through the IOcrPage.Zones property.
The IOcrZoneCollection interface implements standard .NET ICollection{T}, IList{T}, and IEnumerable{T} interfaces and hence, you can use the member of these interfaces to add, remove, get, set and iterate through the different zones in the page.
To work with the zones of the page, you can first call IOcrPage.AutoZone. This will start the page layout decomposition process and the engine will fill the IOcrPage.Zones property with the different zones found. You can then examine or modify the different zones with the various IOcrZoneCollection properties. For example, use IOcrZoneCollection.Add to add a new zone and IOcrZoneCollection.Remove to remove a zone. You can use IOcrZoneCollection.Count to get the number of zones currently in the page.
To modify a zone, use IOcrZoneCollection.Item to get the OcrZone object you are interested in, modify the zone then set it back through IOcrZoneCollection.Item. Note that since OcrZone is a structure (value type), you must 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 OcrZone zone = ocrPage.Zones[3]; // Prevent this zone from being recognized zone.ZoneType = OcrZoneType.Graphic; ocrPage.Zones[3] = zone;
When adding or updating a zone, you should directly initialize the OcrZone.Bounds, OcrZone.FillMethod, OcrZone.RecognitionModule, OcrZone.CharacterFilters and the OcrZone.ZoneType properties of the zone, since they will not take on their default values.
You should not modify the OcrZone.Id property. When adding zones, leave this value to the default of 0.
The OcrZone.ZoneType property of the updating zone should be one of the following: OcrZoneType.Text, OcrZoneType.Table or OcrZoneType.Graphics.
The preferred method of updating a zone is as illustrated in the code snippet above, first get the zone you are interested in, update it and set it back into the collection.
It is your responsibility to specify a valid recognition module-filling method pair. Otherwise any incorrectly set zone will have no recognition result. For more information, refer to An Overview of OCR Recognition Modules.
Calling IOcrPage.AutoZone will clear the zones in the IOcrPage.Zones collection and fills it again with the zones found by the engine.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
IOcrZoneCollection Members
Leadtools.Forms.Ocr Namespace
OcrZone Structure
IOcrPage Interface
OcrEngineManager Class
OcrEngineType Enumeration
Programming with LEADTOOLS .NET OCR
Summary of All Supported Image File Formats
public interface IOcrZoneCollection : System.Collections.Generic.ICollection<OcrZone>, System.Collections.Generic.IEnumerable<OcrZone>, System.Collections.Generic.IList<OcrZone>, System.Collections.IEnumerable
'Declaration Public Interface IOcrZoneCollection Inherits System.Collections.Generic.ICollection(Of OcrZone), System.Collections.Generic.IEnumerable(Of OcrZone), System.Collections.Generic.IList(Of OcrZone), System.Collections.IEnumerable
'Usage Dim instance As IOcrZoneCollection
public interface IOcrZoneCollection : System.Collections.Generic.ICollection<OcrZone>, Windows.Foundation.Collections.IIterable //In WinRT the IEnumerableinterface is replaced by IIterable <OcrZone>, Windows.Foundation.Collections.IVector //In WinRT the IListinterface is replaced by IVector <OcrZone>, System.Collections.IEnumerable
function Leadtools.Forms.Ocr.IOcrZoneCollection() System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.IEnumerable
public interface class IOcrZoneCollection : public System.Collections.Generic.ICollection<OcrZone>, System.Collections.Generic.IEnumerable<OcrZone>, System.Collections.Generic.IList<OcrZone>, System.Collections.IEnumerable
IOcrZoneCollection holds the zones currently added into an OCR page. You can access the instance of the IOcrZoneCollection used by a IOcrPage through the IOcrPage.Zones property.
The IOcrZoneCollection interface implements standard .NET ICollection{T}, IList{T}, and IEnumerable{T} interfaces and hence, you can use the member of these interfaces to add, remove, get, set and iterate through the different zones in the page.
To work with the zones of the page, you can first call IOcrPage.AutoZone. This will start the page layout decomposition process and the engine will fill the IOcrPage.Zones property with the different zones found. You can then examine or modify the different zones with the various IOcrZoneCollection properties. For example, use IOcrZoneCollection.Add to add a new zone and IOcrZoneCollection.Remove to remove a zone. You can use IOcrZoneCollection.Count to get the number of zones currently in the page.
To modify a zone, use IOcrZoneCollection.Item to get the OcrZone object you are interested in, modify the zone then set it back through IOcrZoneCollection.Item. Note that since OcrZone is a structure (value type), you must 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 OcrZone zone = ocrPage.Zones[3]; // Prevent this zone from being recognized zone.ZoneType = OcrZoneType.Graphic; ocrPage.Zones[3] = zone;
When adding or updating a zone, you should directly initialize the OcrZone.Bounds, OcrZone.FillMethod, OcrZone.RecognitionModule, OcrZone.CharacterFilters and the OcrZone.ZoneType properties of the zone, since they will not take on their default values.
You should not modify the OcrZone.Id property. When adding zones, leave this value to the default of 0.
The OcrZone.ZoneType property of the updating zone should be one of the following: OcrZoneType.Text, OcrZoneType.Table or OcrZoneType.Graphics.
The preferred method of updating a zone is as illustrated in the code snippet above, first get the zone you are interested in, update it and set it back into the collection.
It is your responsibility to specify a valid recognition module-filling method pair. Otherwise any incorrectly set zone will have no recognition result. For more information, refer to An Overview of OCR Recognition Modules.
Calling IOcrPage.AutoZone will clear the zones in the IOcrPage.Zones collection and fills it again with the zones found by the engine.
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2