Can I use Aspose.BarCode for recognizing PDF417 in US Driver License using a generic tablet camera? I tried holding a US Driver License in front of the camera of a Surface 11 Pro running an app that recognizes PDF417, but it didn’t seem to recognize the PDF417 in the DL. Simple PDF417 with short strings of say 10 characters are recognized just fine.
Code I am using to decode the barcode:
public List<BarcodeResult> Decode(Stream stream)
{
var results = new List<BarcodeResult>();
using (var reader = new BarCodeReader(stream, DecodeType.Pdf417, DecodeType.QR))
{
foreach (var result in reader.ReadBarCodes())
{
results.Add(new BarcodeResult
{
Value = result.CodeText,
Rectangle = result.Region.Rectangle
});
}
}
return results;
}
@suhailmahmood
Yes, you can use Aspose.BarCode to recognize PDF417 barcodes on US Driver Licenses using a generic tablet camera. However, the success of recognition can depend on several factors, including the quality of the camera, lighting conditions, and the distance from which the barcode is scanned.
From your description, it seems that while simple PDF417 codes with short strings are recognized, the more complex codes on a Driver License may not be. Here are a few suggestions to improve recognition:
-
Camera Quality: Ensure that the camera is capable of capturing high-resolution images. A higher resolution can help in better recognition of complex barcodes.
-
Lighting Conditions: Make sure that the barcode is well-lit and that there are no reflections or shadows obscuring it. Good lighting can significantly enhance the recognition rate.
-
Distance and Angle: Try adjusting the distance and angle at which you hold the Driver License in front of the camera. Sometimes, moving closer or tilting the card can help the camera focus better on the barcode.
-
Image Processing: If possible, preprocess the image before passing it to the barcode reader. This can include adjusting brightness, contrast, or applying filters to enhance the barcode visibility.
-
Code Implementation: Your current implementation looks good, but ensure that you are using the correct DecodeType
for PDF417. You might want to check if there are any additional settings or parameters that can be adjusted in the BarCodeReader
class to improve recognition.
Here’s a sample code snippet that you can use to ensure you are correctly setting up the barcode reader:
public List<BarcodeResult> Decode(Stream stream)
{
var results = new List<BarcodeResult>();
using (var reader = new BarCodeReader(stream, DecodeType.Pdf417))
{
foreach (var result in reader.ReadBarCodes())
{
results.Add(new BarcodeResult
{
Value = result.CodeText,
Rectangle = result.Region.Rectangle
});
}
}
return results;
}
Make sure to test under various conditions to find the optimal setup for recognizing the PDF417 barcode on the Driver License.
If you continue to experience issues, consider checking the Aspose documentation or forums for additional tips and troubleshooting steps related to barcode recognition.
Sources:
[1]: RecognitionFromPDF.java
@suhailmahmood,
Moreover, in case you still find the issue, kindly share the barcode image. We will look into it soon.
We have created task, but we do not have ETA (do bot have time to implement). I think you can use side tool for parsing, before we implement driver ID creation and parsing.
@suhailmahmood
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): BARCODENET-39044
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.