根据AAMVA卡的设计标准,PDF417二维条码符号系统是符合驾驶执照/识别文件必须存在的最低强制性机读技术。条形码编码关于持卡人的关键信息,包括姓名、出生日期、性别、眼睛颜色、身高等等。
从驾驶执照中提取数据有两种方法。我们可以使用OCR技术识别ID上打印的字符。或者,我们可以使用条形码识别技术对PDF417符号系统进行解码,然后将其解析为可读的格式。一般来说,后者比前者更准确,性价比更高。
本文将讨论如何使用Dynamsoft Barcode Reader SDK从驾驶执照中提取文本。
在线演示
要了解这是如何进行的,你可以尝试在线演示 - 查看驾驶执照的PDF417条码。
请注意,此演示还提供文档扫描,由Dynamsoft Web TWAIN SDK提供支持。
如何从PDF417驾驶执照中提取数据
步骤1.检测并解码PDF417代码
var barcodeImage = DWObject.GetImageURL(index, -1, -1);
dbrObject.readURLAsync(barcodeImage,
index,
GetBarcodeInfo,
OnBarcodeReadFailure);
function OnBarcodeReadFailure(sImageIndex, errorCode, errorString) {
console.log(errorString);
}
function GetBarcodeInfo(sImageIndex, result) {//This is the function called when barcode is read successfully
//Retrieve barcode details
var count = result.getCount();
if (count == 0) {
alert("The barcode for the selected format is not found.");
return;
} else {
for (i = 0; i < count; i++) {
Barcode_text = result.get(i).text;
var x = result.get(i).x1;
var y = result.get(i).y1;
var format = result.get(i).formatString;
var barcodeText = ("barcode[" + (i + 1) + "]: " + "\n" + Barcode_text + "\n");
extractInformation();
}
}
}
步骤2.将其解析成可读的格式
driverLicenseFields = [
{ 'abbreviation': 'DAA', 'description': 'Full Name' }
, { 'abbreviation': 'DAB', 'description': 'Last Name' }
, { 'abbreviation': 'DAB', 'description': 'Family Name' }
, { 'abbreviation': 'DAC', 'description': 'First Name' }
, { 'abbreviation': 'DAC', 'description': 'Given Name' }
, { 'abbreviation': 'DAD', 'description': 'Middle Name or Initial' }
, { 'abbreviation': 'DAD', 'description': 'Middle Name' }
, { 'abbreviation': 'DAE', 'description': 'Name Suffix' }
, { 'abbreviation': 'DAF', 'description': 'Name Prefix' }
, { 'abbreviation': 'DAG', 'description': 'Mailing Street Address1' }
, { 'abbreviation': 'DAH', 'description': 'Mailing Street Address2' }
, { 'abbreviation': 'DAI', 'description': 'Mailing City' }
, { 'abbreviation': 'DAJ', 'description': 'Mailing Jurisdiction Code' }
, { 'abbreviation': 'DAK', 'description': 'Mailing Postal Code' }
, { 'abbreviation': 'DAL', 'description': 'Residence Street Address1' }
, { 'abbreviation': 'DAM', 'description': 'Residence Street Address2' }
, { 'abbreviation': 'DAN', 'description': 'Residence City' }
, { 'abbreviation': 'DAO', 'description': 'Residence Jurisdiction Code' }
, { 'abbreviation': 'DAP', 'description': 'Residence Postal Code' }
, { 'abbreviation': 'DAQ', 'description': 'License or ID Number' }
, { 'abbreviation': 'DAR', 'description': 'License Classification Code' }
, { 'abbreviation': 'DAS', 'description': 'License Restriction Code' }
, { 'abbreviation': 'DAT', 'description': 'License Endorsements Code' }
, { 'abbreviation': 'DAU', 'description': 'Height in FT_IN' }
, { 'abbreviation': 'DAV', 'description': 'Height in CM' }
, { 'abbreviation': 'DAW', 'description': 'Weight in LBS' }
, { 'abbreviation': 'DAX', 'description': 'Weight in KG' }
, { 'abbreviation': 'DAY', 'description': 'Eye Color' }
, { 'abbreviation': 'DAZ', 'description': 'Hair Color' }
, { 'abbreviation': 'DBA', 'description': 'License Expiration Date' }
, { 'abbreviation': 'DBB', 'description': 'Date of Birth' }
, { 'abbreviation': 'DBC', 'description': 'Sex' }
, { 'abbreviation': 'DBD', 'description': 'License or ID Document Issue Date' }
, { 'abbreviation': 'DBE', 'description': 'Issue Timestamp' }
, { 'abbreviation': 'DBF', 'description': 'Number of Duplicates' }
, { 'abbreviation': 'DBG', 'description': 'Medical Indicator Codes' }
, { 'abbreviation': 'DBH', 'description': 'Organ Donor' }
, { 'abbreviation': 'DBI', 'description': 'Non-Resident Indicator' }
, { 'abbreviation': 'DBJ', 'description': 'Unique Customer Identifier' }
, { 'abbreviation': 'DBK', 'description': 'Social Security Number' }
, { 'abbreviation': 'DBL', 'description': 'Date Of Birth' }
, { 'abbreviation': 'DBM', 'description': 'Social Security Number' }
, { 'abbreviation': 'DBN', 'description': 'Full Name' }
, { 'abbreviation': 'DBO', 'description': 'Last Name' }
, { 'abbreviation': 'DBO', 'description': 'Family Name' }
, { 'abbreviation': 'DBP', 'description': 'First Name' }
, { 'abbreviation': 'DBP', 'description': 'Given Name' }
, { 'abbreviation': 'DBQ', 'description': 'Middle Name' }
, { 'abbreviation': 'DBQ', 'description': 'Middle Name or Initial' }
, { 'abbreviation': 'DBR', 'description': 'Suffix' }
, { 'abbreviation': 'DBS', 'description': 'Prefix' }
, { 'abbreviation': 'DCA', 'description': 'Virginia Specific Class' }
, { 'abbreviation': 'DCB', 'description': 'Virginia Specific Restrictions' }
, { 'abbreviation': 'DCD', 'description': 'Virginia Specific Endorsements' }
, { 'abbreviation': 'DCE', 'description': 'Physical Description Weight Range' }
, { 'abbreviation': 'DCF', 'description': 'Document Discriminator' }
, { 'abbreviation': 'DCG', 'description': 'Country territory of issuance' }
, { 'abbreviation': 'DCH', 'description': 'Federal Commercial Vehicle Codes' }
, { 'abbreviation': 'DCI', 'description': 'Place of birth' }
, { 'abbreviation': 'DCJ', 'description': 'Audit information' }
, { 'abbreviation': 'DCK', 'description': 'Inventory Control Number' }
, { 'abbreviation': 'DCL', 'description': 'Race Ethnicity' }
, { 'abbreviation': 'DCM', 'description': 'Standard vehicle classification' }
, { 'abbreviation': 'DCN', 'description': 'Standard endorsement code' }
, { 'abbreviation': 'DCO', 'description': 'Standard restriction code' }
, { 'abbreviation': 'DCP', 'description': 'Jurisdiction specific vehicle classification description' }
, { 'abbreviation': 'DCQ', 'description': 'Jurisdiction-specific' }
, { 'abbreviation': 'DCR', 'description': 'Jurisdiction specific restriction code description' }
, { 'abbreviation': 'DCS', 'description': 'Family Name' }
, { 'abbreviation': 'DCS', 'description': 'Last Name' }
, { 'abbreviation': 'DCT', 'description': 'Given Name' }
, { 'abbreviation': 'DCT', 'description': 'First Name' }
, { 'abbreviation': 'DCU', 'description': 'Suffix' }
, { 'abbreviation': 'DDA', 'description': 'Compliance Type' }
, { 'abbreviation': 'DDB', 'description': 'Card Revision Date' }
, { 'abbreviation': 'DDC', 'description': 'HazMat Endorsement Expiry Date' }
, { 'abbreviation': 'DDD', 'description': 'Limited Duration Document Indicator' }
, { 'abbreviation': 'DDE', 'description': 'Family Name Truncation' }
, { 'abbreviation': 'DDF', 'description': 'First Names Truncation' }
, { 'abbreviation': 'DDG', 'description': 'Middle Names Truncation' }
, { 'abbreviation': 'DDH', 'description': 'Under 18 Until' }
, { 'abbreviation': 'DDI', 'description': 'Under 19 Until' }
, { 'abbreviation': 'DDJ', 'description': 'Under 21 Until' }
, { 'abbreviation': 'DDK', 'description': 'Organ Donor Indicator' }
, { 'abbreviation': 'DDL', 'description': 'Veteran Indicator' }
, { 'abbreviation': 'PAA', 'description': 'Permit Classification Code' }
, { 'abbreviation': 'PAB', 'description': 'Permit Expiration Date' }
, { 'abbreviation': 'PAC', 'description': 'Permit Identifier' }
, { 'abbreviation': 'PAD', 'description': 'Permit IssueDate' }
, { 'abbreviation': 'PAE', 'description': 'Permit Restriction Code' }
, { 'abbreviation': 'PAF', 'description': 'Permit Endorsement Code' }
, { 'abbreviation': 'ZVA', 'description': 'Court Restriction Code' }
]
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。