1

我正在尝试阅读驾驶执照的背面以解码背面的 pdf417 条形码。我尝试使用带有以下代码的 zxing.net:

var reader = new BarcodeReader();
reader.Options.PossibleFormats = new List<BarcodeFormat>() { BarcodeFormat.PDF_417 };
var barcodeBitmap = (Bitmap)Image.FromFile("bc.png");
var result = reader.Decode(barcodeBitmap);

该图像是我从互联网上抓取的测试图像:

pdf 417 测试图像

我能够解析出 PDF417 条码,但如何从中获取实际的驾照数据?

@ ANSI 6360050101DL00300203DLDAQ3265188 DAALOTT,ERIC,B,DAG763 测试街 DAINEW YORK CITY DAJSC DAK10005
DARD
DAS
DAT
DAU601 DAW170 DAYBRO
DAZBRO
DBA20241004 DBB19911001 DBC1 DBD14G

4

2 回答 2

1

美国 50 个州中的大多数都遵循 AAMVA DL/ID 标准https://www.aamva.org/DL-ID-Card-Design-Standard/。转到网站并单击“文档”选项卡。下载最新的 2016 年文档。从第 54 页开始,它解释了条形码内容中的所有数据元素。根据该文件,驾驶执照在其元素之后开始DAQ。因此,在您的示例中,驾照3265188出现DAQ在下一个元素DAA, 开始之后和之前。

于 2021-01-30T05:16:04.717 回答
0

您可以在您的应用程序中使用 LEADTOOLS Forms SDK 技术。 https://www.leadtools.com/sdk/ocr/forms/recognition-processing 您可以利用 BarcodeEngine 和 AAMVAID 类,这将允许您识别 PDF417 AAMVA 条形码并提取编码信息。请注意,我是该工具包的员工。

披露:我是提供此工具包的公司的员工。

这是一些示例代码:

using (RasterCodecs _codecs = new RasterCodecs())
using (RasterImage _image = _codecs.Load(@"C:\LEADTOOLS21\Resources\Images\license_sample_rear_aamva.png"))
{
    // Create the BarcodeEngine
    BarcodeEngine _bcEngine = new BarcodeEngine();
    BarcodeData _data = _bcEngine.Reader.ReadBarcode(_image, LeadRect.Empty, BarcodeSymbology.PDF417);
    if (_data.Value != null && _data.Symbology == BarcodeSymbology.PDF417)
    {
        AAMVAID _id = BarcodeData.ParseAAMVAData(_data.GetData(), false);
        if (_id != null)
        {
            Console.WriteLine("AAMVA PDF417 Barcode Found!\n" + 
                  "==============================================="); 
            Console.WriteLine($"Issuer Identification Number: {_id.IssuerIdentificationNumber}\n" + 
                  $"First Name: {_id.FirstName.Value}\n" + 
                  $"Last Name: {_id.LastName.Value}\n" + 
                  $"Over 21? {_id.Over21}\n");
            // Note: There are many more properties in the AAMVAID class to gather data. 
        }
        else
        {
            Console.WriteLine("Does not meet AAMVA specifications");   
        }
    }
    else
    {
        Console.WriteLine("PDF417 Barcode Not Found!");
    }
}

我试过你图片中的条形码,这就是我收到的。

AAMVA 提取结果

于 2021-01-21T18:35:16.170 回答