ImageGear .NET
Work with the Recognition API

This code demonstrates loading and recognizing the TEST1.TIF image file. The image contains English, machine-printed text. The result will be saved in the TEST1.TXT text file.

C#
Copy Code
//Placed at top of file
using ImageGear.Core;
using ImageGear.Formats;
using ImageGear.Recognition;
C#
Copy Code
   ImGearRecognition igRecognition = new ImGearRecognition();
   ImGearPage igPage;
   using (FileStream localFile = new FileStream("TEST1.TIF", FileMode.Open))
    igPage = ImGearFileFormats.LoadPage(localFile, 0);
   ImGearRecPage igRecPage = igRecognition.ImportPage((ImGearRasterPage)igPage);
   igRecognition.OutputManager.CodePage = "Windows ANSI";
   igRecognition.OutputManager.Level = ImGearRecOutputLevel.NOFORMAT;
   igRecognition.OutputManager.Format = "Converters.Text.Text";
            igRecPage.Recognize();
            ImGearRecDocument document = ImGearRecDocument.Create(null);
            document.InsertPage(igRecPage, -1);
   igRecognition.OutputManager.WriteDocument(document, "TEST1.TXT");
            document.Dispose();
            igRecognition.Dispose();
VB .NET
Copy Code
Dim igRecognition As New ImGearRecognition()
Dim igPage As ImGearPage
Using localFile As New FileStream("TEST1.TIF", FileMode.Open)
      igPage = ImGearFileFormats.LoadPage(localFile, 0)
End Using
Dim igRecPage As ImGearRecPage = igRecognition.ImportPage(DirectCast(igPage, ImGearRasterPage))

igRecognition.OutputManager.CodePage = "Windows ANSI"
igRecognition.OutputManager.Level = ImGearRecOutputLevel.NOFORMAT
igRecognition.OutputManager.Format = "Converters.Text.Text"

igRecPage.Recognize()

Dim document As ImGearRecDocument = ImGearRecDocument.Create(Nothing)
document.InsertPage(igRecPage, -1)
igRecognition.OutputManager.WriteDocument(document, "TEST1.TXT")
document.Dispose()
igRecognition.Dispose()

This section provides information about the following:

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback