Leadtools.Forms.Ocr Namespace : IOcrZoneManager Interface |
public interface IOcrZoneManager
'Declaration Public Interface IOcrZoneManager
'Usage Dim instance As IOcrZoneManager
public interface IOcrZoneManager
@interface LTOcrZoneManager : NSObject
public class OcrZoneManager
function Leadtools.Forms.Ocr.IOcrZoneManager()
public interface class IOcrZoneManager
You can access the instance of the IOcrZoneManager used by an IOcrEngine through the IOcrEngine.ZoneManager property.
When calling the IOcrPage.AutoZone method on a page, the generated zone's type (OcrZone.ZoneType), recognition module (OcrZone.RecognitionModule) and fill method (OcrZone.FillMethod) will always be one of the supported values as reported by the IOcrZoneManager.
Before manually changing any of the above zone properties, you must determine whether the particular value is supported by this instance of IOcrEngine. You do this by using the instance of IOcrZoneManager of the engine through the IOcrEngine.ZoneManager property as follows:
To get all the supported zone types, recognition modules or fill methods use GetSupportedZoneTypes, GetSupportedRecognitionModules and GetSupportedFillMethods respectively.
Imports Leadtools Imports Leadtools.Codecs Imports Leadtools.Forms.Ocr Imports Leadtools.Forms Imports Leadtools.Forms.DocumentWriters Imports Leadtools.WinForms Imports Leadtools.ImageProcessing.Core Public Sub ZoneManagerExample() ' Create an instance of the engine Using ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, False) ' Start the engine using default parameters ocrEngine.Startup(Nothing, Nothing, Nothing, LEAD_VARS.OcrAdvantageRuntimeDir) ' Get the zone manager Dim ocrZoneManager As IOcrZoneManager = ocrEngine.ZoneManager ' Show all the zone types supported by this engine Console.WriteLine("Hit enter to show the supported zone types") Console.ReadLine() Dim zoneTypes() As OcrZoneType = ocrZoneManager.GetSupportedZoneTypes() Console.WriteLine("Supported zone types:") Console.WriteLine("---------------------") For Each zoneType As OcrZoneType In zoneTypes Console.WriteLine(" {0}", zoneType) Next Console.WriteLine("Hit enter to show the supported recognition modules") Console.ReadLine() Dim recognitionModules() As OcrZoneRecognitionModule = ocrZoneManager.GetSupportedRecognitionModules() Console.WriteLine("Supported recognition modules:") Console.WriteLine("---------------------") For Each recognitionModule As OcrZoneRecognitionModule In recognitionModules Console.WriteLine(" {0}", recognitionModule) Next Console.WriteLine("Hit enter to show the supported fill methods") Console.ReadLine() Dim fillMethods() As OcrZoneFillMethod = ocrZoneManager.GetSupportedFillMethods() Console.WriteLine("Supported fillMethods:") Console.WriteLine("---------------------") For Each fillMethod As OcrZoneFillMethod In fillMethods Console.WriteLine(" {0}", fillMethod) Next ' Shutdown the engine ' Note: calling Dispose will also automatically shutdown the engine if it has been started ocrEngine.Shutdown() End Using End Sub
using Leadtools; using Leadtools.Codecs; using Leadtools.Forms.Ocr; using Leadtools.Forms; using Leadtools.Forms.DocumentWriters; using Leadtools.WinForms; public void ZoneManagerExample() { // Create an instance of the engine using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false)) { // Start the engine using default parameters ocrEngine.Startup(null, null, null, LEAD_VARS.OcrAdvantageRuntimeDir); // Get the zone manager IOcrZoneManager ocrZoneManager = ocrEngine.ZoneManager; // Show all the zone types supported by this engine Console.WriteLine("Hit enter to show the supported zone types"); Console.ReadLine(); OcrZoneType[] zoneTypes = ocrZoneManager.GetSupportedZoneTypes(); Console.WriteLine("Supported zone types:"); Console.WriteLine("---------------------"); foreach (OcrZoneType zoneType in zoneTypes) Console.WriteLine(" {0}", zoneType); Console.WriteLine("Hit enter to show the supported recognition modules"); Console.ReadLine(); OcrZoneRecognitionModule[] recognitionModules = ocrZoneManager.GetSupportedRecognitionModules(); Console.WriteLine("Supported recognition modules:"); Console.WriteLine("---------------------"); foreach (OcrZoneRecognitionModule recognitionModule in recognitionModules) Console.WriteLine(" {0}", recognitionModule); Console.WriteLine("Hit enter to show the supported fill methods"); Console.ReadLine(); OcrZoneFillMethod[] fillMethods = ocrZoneManager.GetSupportedFillMethods(); Console.WriteLine("Supported fillMethods:"); Console.WriteLine("---------------------"); foreach (OcrZoneFillMethod fillMethod in fillMethods) Console.WriteLine(" {0}", fillMethod); // Shutdown the engine // Note: calling Dispose will also automatically shutdown the engine if it has been started ocrEngine.Shutdown(); } }
using Leadtools; using Leadtools.Codecs; using Leadtools.Forms.Ocr; using Leadtools.Forms; using Leadtools.Forms.DocumentWriters; [TestMethod] public void ZoneManagerExample() { // Create an instance of the engine IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false); // Start the engine using default parameters ocrEngine.Startup(null, null, String.Empty, Tools.OcrEnginePath); // Get the zone manager IOcrZoneManager ocrZoneManager = ocrEngine.ZoneManager; OcrZoneType[] zoneTypes = ocrZoneManager.GetSupportedZoneTypes(); Debug.WriteLine("Supported zone types:"); Debug.WriteLine("---------------------"); foreach(OcrZoneType zoneType in zoneTypes) Debug.WriteLine(" {0}", zoneType); OcrZoneRecognitionModule[] recognitionModules = ocrZoneManager.GetSupportedRecognitionModules(); Debug.WriteLine("Supported recognition modules:"); Debug.WriteLine("---------------------"); foreach(OcrZoneRecognitionModule recognitionModule in recognitionModules) Debug.WriteLine(" {0}", recognitionModule); OcrZoneFillMethod[] fillMethods = ocrZoneManager.GetSupportedFillMethods(); Debug.WriteLine("Supported fillMethods:"); Debug.WriteLine("---------------------"); foreach(OcrZoneFillMethod fillMethod in fillMethods) Debug.WriteLine(" {0}", fillMethod); // Shutdown the engine ocrEngine.Shutdown(); }
IOcrZoneManager Members
Leadtools.Forms.Ocr Namespace
IOcrPage.AutoZone
OcrZoneType Enumeration
OcrZoneRecognitionModule Enumeration
OcrZoneFillMethod Enumeration
OcrEngineManager Class
OcrEngineType Enumeration
IOcrPageCollection Interface
IOcrZoneCollection Interface
OcrZone Structure
Programming with LEADTOOLS .NET OCR
Working with OCR Zones