←Select platform

IDCardReader Class

Summary

ID Card Reader

Syntax
C#
VB
C++
Java
public class IDCardReader 
Public Class IDCardReader 
public ref class IDCardReader 
public class IDCardReader 
Remarks

The IDCardReader class uses LEADTOOLS OCR technology to parse data from identification cards. Currently, this engine supports US and EU driver license cards.

The engine is designed for progressive recognition from a live camera capture. Frames are fed and the engine will try to extract as much data from each frame as possible and in the process will combine results from the most accurate recognition data till all the required fields are read. The user can stop the processing at any time if enough data is required, or continue till the engine finishes reading all the data. The engine might read all the data from the first frame if the image contains very clear data. Therefore, the engine also supports reading the ID data (all or partial) from a single frame.

The engine returns the results in an IDCardResults type which contains the following data:

Typical workflow is as follows:

Start by creating an engine instance and initialize it. This is typically done in the application's startup code.

void Startup() 
{ 
// Create the OCR engine to be used with this demo 
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD); 
ocrEngine.Startup(null, null, null, PATH_TO_OCR_RUNTIME); 
// Create an ID card reader 
IDCardReader cardReader = new IDCardReader(ocrEngine); 
} 

Next, assume the user interface contains a button to start capturing from the camera and begin recognition. Insert the following code there to begin a new capture process:

void StartRecognition() 
{ 
// Start new recognition process 
cardReader.ResetRecognitionData(); 
// Start capturing from the camera 
StartCameraCapture(); 
} 

During each frame acquired by the camera, create a RasterImage instance from it and send it to the engine using the following code. Note the check for the result of ProcessFrame to indicate when reading is finished:

void ProcessCameraFrame(RasterImage frameImage) 
{ 
// Process this frame 
if (cardReader.ProcessFrame(frameImage)) 
{ 
// The engine is done, grab the results 
IDCardResults results = cardReader.Results; 
// Stop capturing from the camera 
StopCameraCapture(); 
// Display the results to the user or continue further processing 
DisplayOrProcessResults(results); 
} 
} 

Depending on the application, only some of the data be required, (for example, only the ID). Therefore, the application can use code similar to the following to perform recognition:

void ProcessCameraFrame(RasterImage frameImage) 
{ 
// Process this frame 
cardReader.ProcessFrame(frameImage); 
// See if have a valid ID number 
FieldResult idNumber = cardReader.Results.IDNumber; 
if (idNumber.Confidence > 75) // Stop when we have 75% or above accuracy 
{ 
// We are done, grab the results 
string idNumberValue = idNumber.Text; 
// Stop captruing from the camera 
StopCameraCapture(); 
// Display the results to the user or continue further processing 
DisplayOrProcessResults(idNumberValue); 
} 
} 

Requirements
Target Platforms
Help Version 21.0.2021.6.30
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Forms.Commands Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.