Using the BankCheckReader Class

Take the following steps to create a project and add some code that loads and reads the machine-printed information on a bank check image.

  1. Start Visual Studio 2015.
  2. ChooseFile->New->项目from the menu.
  3. In theNew Projectdialog box, choose either "Visual C# Projects" or "VB Projects" in the Projects Type List, and choose "Console Application" in the Templates List.
  4. Type the project name as "CheckReaderDemo" in the项目Namefield, and then clickOK. If desired, type a new location for your project or select a directory using theBrowsebutton, and then clickOK.
  5. In theSolution Explorerwindow, right-click on theReferencesfolder, and select "Add Reference..." from the context menu. In the "Add Reference" dialog box, select the ".NET" tab, browse to the "\Bin\Dotnet4\Win32" folder (or "\Bin\Dotnet4\Win32" if you are going to use .NET 4), and select the following DLLs:

    引领tools.dll引领tools.Codecs.dll引领tools.Codecs.Cmp.dll引领tools.Forms.Commands.dll引领tools.Document.Writer.dll引领tools.Ocr.dll引领tools.Ocr.LEADEngine.dll
    Click theSelectbutton and then press theOKbutton to add the above DLLs to the application.

  6. Add the following lines at the beginning of the file:

    using引领tools;using引领tools.Codecs;using引领tools.Forms.Commands;using引领tools.Ocr;

  7. In the Main() method, add the following initialization code, changing the placeholder values to the actual location and value of the license and developer key.
    stringMY_LICENSE_FILE ="d:\\temp\\TestLic.lic";stringMY_DEVELOPER_KEY ="xyz123abc";RasterSupport.SetLicense(MY_LICENSE_FILE, MY_DEVELOPER_KEY);stringchequePath =@"C:\LEADTOOLS22\Resources\Images\BankCheck.jpg";RasterCodecs codecs =newRasterCodecs();RasterImage image = codecs.Load(chequePath);BankCheckReader chequeReader =newBankCheckReader();
  8. Add the following lines of code to load and read the check image.
    using(IOcrEngine engine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD)){engine.Startup(codecs,null,null,null);chequeReader.OcrEngine = engine;chequeReader.ProcessImage(image);engine.Shutdown();}
  9. Add the following lines of code to display the results on the console.
    foreach(KeyValuePair<string, BankCheckField> kvpinchequeReader.Results){Console.WriteLine(kvp.Key +"\t\t"+ kvp.Value.Text);}
  10. Finally, add the following lines of code for clean-up.
    image.Dispose();codecs.Dispose();Console.ReadLine();
  11. Build, run, and test the program. The detected information will be printed in the console window. Press Enter to close and exit the program
LEADTOOLS Imaging, Medical, and Document
188金宝搏的网址客服|Support|Contact Us|Intellectual Property Notices
© 1991-2023LEAD Technologies, Inc.All Rights Reserved.