First I am not sure if this is an array. But this is pyzbar decoding an image of a QRcode
>>> from pyzbar.pyzbar import decode
>>> from PIL import Image
>>> barcode = decode(Image.open('qr111.png'))
>>> print(barcode)
[Decoded(data='812', type='QRCODE', rect=Rect(left=1166, top=306, width=336, height=336), polygon=[Point(x=1166, y=306), Point(x=1166, y=642), Point(x=1502, y=642), Point(x=1502, y=306)])]
I want to retrieve specifically the value "812" of data, how do I do it? I tried print(barcode[Decoded(data)]) to no avail.
asked May 29, 2018 at 9:10
Julliard
5531 gold badge6 silver badges24 bronze badges
1 Answer 1
answered May 29, 2018 at 9:15
zipa
28k6 gold badges45 silver badges62 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-py
print(barcode[0].data).Decodedlooks like name of type in that case, and outer[..]looks like a list.