class DataMatrix – DataMatrix object#

The datamatrix object is an attrtuple returned by Image.find_datamatrices(). Each instance describes a decoded Data Matrix 2D-barcode: its bounding box, decoded payload, in-image-plane rotation, layout metadata (rows, columns, capacity, padding), and the four detected corners.

Fields are accessible by attribute name (dm.payload) or by index (dm[0]). The object has no public constructor.

class image.datamatrix#

Please call Image.find_datamatrices() to create this object.

Bounding box and corners#

x#

Bounding box top-left x coordinate, in pixels. Integer. Index [0].

y#

Bounding box top-left y coordinate, in pixels. Integer. Index [1].

w#

Bounding box width, in pixels. Integer. Index [2].

h#

Bounding box height, in pixels. Integer. Index [3].

corners#

4-tuple of (x, y) integer tuples for the four detected corners of the data matrix, sorted clockwise starting from the top-left corner. Index [10].

rect#

(x, y, w, h) 4-tuple of the bounding box. Suitable for passing directly to drawing/cropping methods such as Image.draw_rectangle() or Image.crop(). Index [11].

Decoded payload#

payload#

Decoded payload string. Index [4].

rotation#

In-image-plane rotation of the data matrix in radians. Float. Index [5].

Layout#

rows#

Number of cell rows in the data matrix. Integer. Index [6].

columns#

Number of cell columns in the data matrix. Integer. Index [7].

capacity#

Maximum number of payload characters this data matrix could carry at the current row/column size. Integer. Index [8].

padding#

Number of unused payload character slots in this data matrix (capacity - len(payload)). Integer. Index [9].