This tutorial explains how to read Data Matrix barcode using Python. All the necessary details are provided such as set up the IDE, a list of programming steps, and sample code for a Data Matrix reader in Python. Different options will be introduced to customize the reading process.
Steps to Scan Data Matrix Code using Python
- Set up the development environment to use Aspose.BarCode for Python via .NET to scan Data Matrix barcode
- Import the necessary classes and modules from the above Python library
- Apply a license to read Data Matrix code text; otherwise, partial reading will be done
- Instantiate the BarCodeReader object for reading Data Matrix code from the given image
- Set the quality settings to high for handling the harder images
- Invoke the read_bar_codes() method to read all the Data Matrix codes
- Iterate through all the codes and display a few properties such as code text, symbology, and region
TThe steps above outline the procedure to develop a Data Matrix code reader using Python. Apply the license as only Code39 can be read without restrictions in the trial mode, initialize the reader with the target decode type Data Matrix and the image file name, and improve the accuracy for harder images. Finally, read the barcodes with the given parameters and iterate through all the images by printing all the properties.
Code for Data Matrix Code Scanner using Python
The given code shows how to develop a Data Matrix scanner in Python. You can set a list of decode types by adding GS1_DATA_MATRIX to read all types of Data Matrix codes from the image. To control the long recognition cycle, use the reader.timeout property; try the result.confidence property to filter out unreliable reads.
This article assists in reading Data Matrix codes. To create a Data Matrix code, refer to the article Generate Data Matrix Barcode using Python.