Represents a field from a business card image.
public class BCResult
Public Class BCResult
public:
ref class BCResult
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Forms.Common;
using Leadtools.Ocr;
using Leadtools.Forms.Commands;
public void TestBusinessCardReader()
{
// Initialize the RasterCodecs class
RasterCodecs codecs = new RasterCodecs();
// The business card image
string chequePath = Path.Combine(LEAD_VARS.ImagesDir, "original.jpg");
RasterImage image = codecs.Load(chequePath);
//Start up barcode
BarcodeEngine barcodeEngine = new BarcodeEngine();
//Start up Ocr engine
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
ocrEngine.Startup(codecs, null, null, LEAD_VARS.OcrLEADRuntimeDir);
// Initialize the BusinessCardReader class
BusinessCardReader BCReader = new BusinessCardReader(ocrEngine, barcodeEngine);
BCProcessStatus status = BCReader.Process(image);
if (status == BCProcessStatus.BlurDetected)
Messager.ShowError(this, "Blur detected in image.");
else if (status == BCProcessStatus.GlareDetected)
Messager.ShowError(this, "Glare detected in image.");
else if (status == BCProcessStatus.Failed)
Messager.ShowError(this, "Failed to recognize image.");
else if (status == BCProcessStatus.Success)
{
if (BCReader.Results != null)
{
foreach (var res in BCReader.Results)
{
LeadRect bounds = res.Value.Bounds;
Console.WriteLine(string.Format("Field Name : {0}", res.Key));
Console.WriteLine(string.Format("Field Value : {0}", res.Value.Value));
Console.WriteLine(string.Format("Field Confidence : {0}", res.Value.Confidence));
Console.WriteLine(string.Format("Field Bounds : {0},{0},{0},{0}", bounds.X.ToString(), bounds.Y.ToString(), bounds.Width.ToString(), bounds.Height.ToString()));
Console.WriteLine("************************************");
}
}
}
ocrEngine.Shutdown();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
public const string OcrLEADRuntimeDir = @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime";
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document