By reading this piece, you will learn about the tips and tricks to generate one-dimensional barcodes in different formats as well as Quick Response code (QR Code) generation. Besides, this tutorial will outline the methods to decode both the barcode and QR Code using the same Python library. Previously, I have covered a tutorial on How to Generate and Decode QR Codes in Python which used OpenCV to decode QR Codes. In this tutorial, I will be using another module called pyzbar for decoding instead. Based on the official documentation, pyzbar is
“… a pure Python library that reads one-dimensional barcodes and QR codes using the zbar library, an open source software suite for reading bar codes from various sources, such as video streams, image files and raw intensity sensors. It supports many popular symbologies (types of bar codes) including EAN-13/UPC-A, UPC-E, EAN-8, Code 128, Code 39, Interleaved 2 of 5 and QR Code.”
Based on the experiments that I have conducted, pyzbar performs better compared to python-opencv in terms of accuracy when decoding QR Codes. On top of that, pyzbar is able to decode barcodes as well.
Let’s proceed to the next section and start installing the necessary modules.
#image-processing #barcode #python #qr-code