#1
Posted
:
Wednesday, February 22, 2017 11:25:12 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 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:
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
Edited by user Tuesday, July 16, 2019 4:21:19 PM(UTC)
| Reason: Not specified
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.
#2
Posted
:
Friday, March 30, 2018 9:21:18 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 89
Was thanked: 4 time(s) in 4 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();
}
VBCode: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
Chris Thompson
Developer Support Engineer
LEAD Technologies, Inc.
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.