Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF417 decoder for python

I've looked everywhere and I've only found information related to generating PDF417 codes, but nothing regarding how to decode them. Is there a library to decode them in python? I'm already detecting the code in an image and croping it, but now I need a decoder.

like image 400
Christian Rodriguez Avatar asked Nov 08 '17 16:11

Christian Rodriguez


2 Answers

I found this little piece of code, which does just what I want. It decodes PDF417 barcodes. Doesn't seem to be that robust though, so I'll guess I'll have to give the images some strong processing to extract only the barcode.

like image 142
Christian Rodriguez Avatar answered Nov 10 '22 19:11

Christian Rodriguez


There are two libraries that I know of for decoding PDF417 barcodes.

You can checkout python-zxing which is a python wrapper for the ZXing decoder or you can use pdf417decoder which is a native Python port of a C# PDF417 decoder library.

ZXing requires files to be saved to the disk first while pdf417decoder can take a PIL Image object directly.

like image 24
Brett Allen Avatar answered Nov 10 '22 18:11

Brett Allen