Here is example code to extract the decode list elements:
import cv2
from pylibdmtx.pylibdmtx import decode
img = cv2.imread('datamatrix_multiple.png')
decodedList = decode(img)
print(decodedList)
print(len(decodedList))
for i in range(len(decodedList)):
print(decodedList[i].data)
print(str(decodedList[i].data, "utf-8")) #removes the b'... formatting
print(decodedList[i].rect.left)
print(decodedList[i].rect.top)
print(decodedList[i].rect.width)
print(decodedList[i].rect.height)
Which prints out the following for an image with two sample datamatrix codes:
[Decoded(data=b'Hello World', rect=Rect(left=64, top=43, width=285, height=150)), Decoded(data=b'12340000001234', rect=Rect(left=58, top=267, width=70, height=70))]
2
b'Hello World'
Hello World
64
43
285
150
b'12340000001234'
12340000001234
58
267
70
70