Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, February 22, 2017 11:30:12 AM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 185

Was thanked: 9 time(s) in 9 post(s)

Attached is a very simple OCR demo showing how easy it is to OCR a document using LEADTOOLS. It is using C# and v19 of LEADTOOLS.

The relevant code is as follows:

Code:
      private void DoOCR(string inputFile, string outputFile, DocumentFormat format)
      {
         using (IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
         {
            ocrEngine.Startup(null, null, null, null);
            ocrEngine.AutoRecognizeManager.Run(inputFile, outputFile, format, null, null);
         }
      }


Here is a screenshot of the demo running:
UserPostedImage

File Attachment(s):
LEADTOOLS SimpleOCRExample.zip (12kb) downloaded 455 time(s).



Attached below is an updated version of this project for LEADTOOLS v20
Alterations in the DLLs
Removed v19 DLLs:
Leadtools.Forms.dll
Leadtools.Forms.DocumentWriters.dll
Leadtools.Forms.Ocr.dll
Leadtools.Forms.Ocr.Advantage.dll

Added v20 DLLs:
Leadtools.Document.Writer.dll
Leadtools.Ocr.dll
Leadtools.Ocr.LEADEngine.dll

File Attachment(s):
LEADTOOLS SimpleOCRExample.zip (276kb) downloaded 161 time(s).

Edited by moderator Thursday, April 19, 2018 11:53:03 AM(UTC)  | Reason: Not specified

Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, March 30, 2018 9:26:18 AM(UTC)
Christopher Thompson

Groups: Tech Support, Administrators
Posts: 45

Was thanked: 2 time(s) in 2 post(s)

With the release of the LEADTOOLS v20 SDK there have been a few changes to our OCR Engines.

We now have the LEAD OCR Engine and the OmniPage OCR Engine.

Which have replaced the Advantage and the Professional OCR Engines.

It is also important to note that when developing a x64 application you will need to reference the OmniPage Runtime specifically for x64 bit applications.

In the below examples I have how to call and startup the ocrEngine for the LEAD Engine and the OmniPage Engine. The examples for the C# sample application are a 32-bit application and the example for the VB ocrEngine startup are in 64-bit. This way you can see the necessity to reference the OcrOmniPageRuntime64 specifically.

Additionally, at the bottom of this post are working examples of both of the OcrEngine.Startup applications that are shown below.
You will need to simply comment out the engine that you are not working with.

C#
Code:
 static void Main(string[] args)
        {
            IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
            string engine = "";

            // Insert your file paths in place of the ones below
            string licenseFilePath = @"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC";
            string keyFilePath = File.ReadAllText(@"C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC.key");

            RasterSupport.SetLicense(licenseFilePath, keyFilePath);

            // TO USE THE LEAD OCR Engine

            // Initialize the OCR engine 
            ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);


            // Start up the OCR Engine
            // Make sure that your path is the same as below OcrLEADRuntime
            ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime");
            engine = "LEAD";

            
            // TO USE THE OmniPage OCR Engine

            // Initialize the OCR engine 
            ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.OmniPage, false);

            // Start up the OCR Engine
            // Make sure that your path is the same as below OcrOmniPageRuntime
            ocrEngine.Startup(null, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrOmniPageRuntime");
            engine = "OmniPage";



            Console.WriteLine(engine + " OCR engine has been started successfully");
            Console.ReadKey();

            // Destroy the engine (will also shut it down) 
            ocrEngine.Dispose();
            Console.WriteLine("OCR engine has been destroyed");
            Console.ReadKey();
        }


VB
Code:
Sub Main()

        Dim engine As String = ""

        Dim MY_LIC_FILE = System.IO.File.ReadAllBytes("C:\LEADTOOLS 20\Common\License\LEADTOOLS.LIC")
        Dim MY_DEV_KEY As String = "input key string here"

        RasterSupport.SetLicense(MY_LIC_FILE, MY_DEV_KEY)

        ' TO USE THE LEAD OCR Engine
        Dim ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, False)

        ' Start up the OCR Engine
        ' Make sure that your path Is the same as below OcrAdvantageRuntime
        ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime")
        engine = "LEAD"


        ' TO USE THE OmniPage Engine
        Dim ocrEngine As IOcrEngine = OcrEngineManager.CreateEngine(OcrEngineType.OmniPage, False)

        ' Start up the OCR Engine
        ' Make sure that your path Is the same as below OcrAdvantageRuntime
        ocrEngine.Startup(Nothing, Nothing, Nothing, "C:\LEADTOOLS 20\Bin\Common\OcrOmniPageRuntime64")
        engine = "OmniPage"


        Console.WriteLine(engine + " OCR engine has been started successfully")
        Console.ReadKey()

        ' Destroy the Engine
        ocrEngine.Dispose()

    End Sub


File Attachment(s):
simpleOcrEngineStartup_20.zip (202kb) downloaded 168 time(s).


File Attachment(s):
simpleOcrEngineStartupVB_20.zip (251kb) downloaded 157 time(s).

Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2018, Yet Another Forum.NET
This page was generated in 0.199 seconds.