Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Capturing Customer Information from Driver's Licenses using LEADTOOLS

2 May 2016 1  
This white paper will explore how programmers can use LEADTOOLS Driver's License Recognition or Barcode Recognition to extract identifying information from driver's licenses.

This article is in the Product Showcase section for our sponsors at CodeProject. These articles are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

A wide variety of businesses are embracing technology as a means to enhance the way customers provide their information on the front-end of the customer service process. Upon arrival at the doctor's office, car dealership, gym or even a restaurant, customers might be handed a tablet or directed to a kiosk to check in. This is an exciting change for device manufacturers and software developers, but does it always translate to better customer service?

If the process is difficult or takes too long, customers are likely to get annoyed, or worse, take their business elsewhere. Therefore using technology for technology's sake isn't enough. To get the most out of their investment, business owners can use various imaging technologies to capture customer information to speed up the process and improve customer satisfaction. An ideal solution would capture information from a document or form of ID customers already have on them such as a driver's license. This white paper will explore how programmers can use LEADTOOLS Driver's License Recognition or Barcode Recognition to extract identifying information from driver's licenses.

Faster Information Gathering

The first time a new customer visits a business, some amount of data gathering is to be expected. Talking to the receptionist and filling out several paper forms may still work in some businesses, but this process is starting to be replaced for several reasons. Data errors are common due to difficult to understand accents, assumed name spellings (i.e. John vs Jon) and poor handwriting. Also, reducing paper and going green is a goal that more and more businesses are trying to accomplish.

Digital data entry through tablets and kiosks is a step in the right direction because it reduces human error by eliminating double entry on paper and computer. Office staff can just review what the customer typed instead of entering what the customer wrote. However, the time it takes for customers to complete the process is a concern. Having too few devices available creates a bottleneck and long lines, and we all know how much customers love standing in line. Balancing the number of devices to demand is hard to do, and the benefits might not outweigh the cost. Speeding up the process with automatic driver's license recognition or barcode recognition can tip the scales favorably on both sides of the counter.

Driver's License Recognition

Driver's licenses are by far one of the most commonly carried forms of photo ID and most customers are happy to show them in situations like these. What most businesses don't realize is that the same documents they may already be using to verify the customer's identity can also be used to kick-start the customer check-in process. This is a missed opportunity to capture accurate, reliable information and make a more satisfying customer experience.

LEADTOOLS can recognize and process structured and unstructured forms including invoices, passports and driver's licenses. Driver's licenses have a lot of great information that is commonly used in any signup form: name, address, sex, birthdate, etc. Just snap a picture with a webcam or the tablet's integrated camera and let LEADTOOLS auto-populate the form, so the customer can simply verify and add any additional information needed. In the same amount of time it takes to type their name, all or most of the form can completed.

Incredibly, this advanced recognition does not require much effort to implement. LEADTOOLS includes master templates for all 50 states and multiple templates for some states with varying designs or layouts. With the high-level AutoFormsEngine class, less than 40 lines of code are needed to identify the form and loop through the captured fields.

// Create the RasterCodecs to be used by OCR and Forms engines
RasterCodecs formsCodec = new RasterCodecs();

// Create an OCR Engine for each processor on the machine. This 
//   allows for optimal use of thread during recognition and processing.
IOcrEngine ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false);
ocrEngine.Startup(formsCodec, null, null, @"C:\LEADTOOLS 19\Bin\Common\OcrAdvantageRuntime");

// Create a master form repository and point it to directory with existing master forms
DiskMasterFormsRepository formsRepository = new DiskMasterFormsRepository(
   formsCodec, 
   @"C:\Users\Public\Documents\LEADTOOLS Images\Forms\MasterForm Sets\Driving License");

// Create the AutoFormsEngine using the repository and ocr engine
AutoFormsEngine autoEngine = new AutoFormsEngine(formsRepository, ocrEngine, null, AutoFormsRecognitionManager.Ocr, 30, 80, true);

// For this tutorial, we will use the sample NC Driver's License
string formToRecognize = 
   @"C:\Users\Public\Documents\LEADTOOLS Images\Forms\Forms to be Recognized\Driving License\License.png";

// Recognize the form
string resultsMessage = "";
AutoFormsRunResult runResult = autoEngine.Run(formToRecognize, null);
if (runResult != null)
{
   FormRecognitionResult recognitionResult = runResult.RecognitionResult.Result;
               
   // Process the fields
   foreach (FormPage formPage in runResult.FormFields)
   {
      foreach (FormField field in formPage)
      {
         if (field != null)
         {
            resultsMessage = String.Format("{0}{1} = {2}{3}",
               resultsMessage,
               field.Name,
               (field.Result as TextFormFieldResult).Text,
               Environment.NewLine);
         }
      }
   }
}
            
if (string.IsNullOrEmpty(resultsMessage))
   MessageBox.Show("The form was not recognized", "Field Processing Results");
else
   MessageBox.Show(resultsMessage, "Field Processing Results");

2D Barcodes

The most familiar barcodes, 1D barcodes, encode a small amount of information to identify a product number or member ID, where less than twenty alphanumeric digits is typically sufficient. There are, however, more advanced barcode symbologies, commonly known as 2D barcodes, which can encode thousands of characters.

In particular, PDF417 barcodes are often found on the backside of driver's licenses. Since PDF417 can store up to 1,850 ASCII characters, issuers can encode all of the licensee’s information into the barcode for quick, easy and reliable reading. Due to robust error correction codes (ECC), PDF417 remains accurate even on old driver's licenses that have seen significant wear and tear.

For example, here's a PDF417 example barcode for a South Carolina driver's license (courtesy of http://www.scdmvonline.com/DMVNew/general/New%20DL%20Barcode.pdf), and its information decoded by LEADTOOLS:

The result may seem cryptic at first glance, but it is actually quite easy to decipher with a proper legend, which most states provide. Here is the plain text with the Last, First and Middle names (Sample, Driver Credential) and Birthdate (09/28/1978) highlighted:

@ ANSI 6360050101DL00300201DLDAQ102245737DAASAMPLE,DRIVER,CREDENTIAL,DAG 1500 PARK STDAICOLUMBIADAJSCDAK292012731 DARD DAS DAT DAU600DAW200DAY DAZ DBA20190928DBB19780928DBC1DBD20091026DBG2DBH1

Reading barcodes with LEADTOOLS is even more programmer-friendly than the forms-based driver's license recognition discussed above. The BarcodeEngine class does all the legwork. When passing default parameters as in the example below, the engine will search the entire image for all 100+ barcode types that LEADTOOLS supports. When the developer knows the image will only use a specific type of barcode or where to limit searching to a specific area of interest (e.g. a rectangle drawn on a live preview of a smartphone) the recognition algorithm will run even faster.

// Read all the barcodes
// The second parameter is the search rectangle. Pass an empty rectangle to indicate the entire image.
// The third parameter is the maximum number of barcodes to read. Pass 0 for all barcodes found in the image.
// Last parameter is an array of the BarcodeSymbology we are interested in. Pass null 
//   to indicate that we do not care, and want all barcodes available to be read
BarcodeEngine barcodeEngine = new BarcodeEngine();
BarcodeData[] dataArray = barcodeEngine.Reader.ReadBarcodes(image, LogicalRectangle.Empty, 0, null);

StringBuilder sb = new StringBuilder();
sb.AppendFormat("{0} barcode(s) found", dataArray.Length);
sb.AppendLine();

for (int i = 0; i < dataArray.Length; i++)
{
   BarcodeData data = dataArray[i]; 
   sb.AppendFormat("Symbology: {0}, Location: {1}, Data: {2}", data.Symbology.ToString(), data.Bounds.ToString(), data.Value);
   sb.AppendLine();
}

MessageBox.Show(sb.ToString());

Conclusion

It's amazing what imaging technology can do these days. Even in an application that seems like a pretty straightforward replacement of paper forms with a digital device for customer-driven data entry, there are significant ways that a LEADTOOLS imaging SDK can speed up and improve the entire workflow. In particular, using driver's licenses is an intuitive and reliable solution that can auto-populate the majority of information businesses need to add customers to their system.

Download the Full Media Streaming Server Example

You can download the fully functional demo which includes the features discussed above. To run this example you will need the following:

  • LEADTOOLS free 60 day evaluation
  • Visual Studio 2008 or later
  • Browse to the LEADTOOLS Examples folder (e.g. C:\LEADTOOLS Multimedia 19\Examples\) where you can find example projects for this and many more technologies in LEADTOOLS

Support

Need help getting this sample up and going? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team (sales@leadtools.com) or call us at 704-332-5532.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here