class QRCode – QRCode object¶
The qrcode object is an attrtuple
returned by Image.find_qrcodes(). Each instance describes a decoded
QR-code: its bounding box, decoded payload, decoder metadata (version, ECC
level, mask, data type, ECI), the four detected corners, and convenience
boolean flags identifying the encoding of the payload.
Fields are accessible by attribute name (qrcode.payload) or by index
(qrcode[0]). The object has no public constructor.
- class image.qrcode¶
Please call
Image.find_qrcodes()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 QR code, 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 asImage.draw_rectangle()orImage.crop(). Index[15].
Decoded payload¶
- payload¶
Decoded payload string. Index
[4].
Decoder metadata¶
- version¶
QR-code version, 1 – 40. Higher versions encode more data and have larger modules. Integer. Index
[5].
- ecc_level¶
Error-correction level, 0 – 3 (corresponding to L / M / Q / H). Higher values reserve more codewords for error correction. Integer. Index
[6].
- mask¶
Mask pattern, 0 – 7. Used by the QR-code encoder to choose the module pattern that minimises decoder confusion. Integer. Index
[7].
- data_type¶
Encoding of the payload as the decoder reported it. One of the following bitmask values:
1numeric,2alphanumeric,4binary,8Kanji. See the per-flag attributes below for a friendlier form. Integer. Index[8].
- eci¶
Extended Channel Interpretation value. Encodes the text encoding used for the bytes in the payload (e.g. UTF-8 versus ISO-8859-1). Integer. Index
[9].
Encoding flags¶
- is_numeric¶
Trueifdata_typeindicates a numeric payload. Index[11].
- is_alphanumeric¶
Trueifdata_typeindicates an alphanumeric payload. Index[12].
- is_binary¶
Trueifdata_typeindicates a binary payload. Checkecito determine the text encoding when this isTrue. Index[13].
- is_kanji¶
Trueifdata_typeindicates a Kanji payload. Kanji symbols are 10 bits per character and MicroPython does not parse this encoding – the payload must be treated as a byte array. Index[14].