Hi, i’m newbie to OpenCV and i use a bit of python, i’m using OpenCV in Touchdesigner to build a qr code reader, i’m using this code:
img = op('null1').numpyArray(delayed=True)
gray = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)
gray = (gray*255).astype(np.uint8)
detector = cv2.QRCodeDetector()
data, bbox, straight_qrcode = detector.detectAndDecode(gray)
# if there is a QR code
if bbox is not None:
#print(f"QRCode data:\n{data}")
# display the image with lines
# length of bounding box
n_lines = len(bbox)
for i in range(n_lines):
# draw all lines
point1 = tuple(bbox[i][0])
point2 = tuple(bbox[(i+1) % n_lines][0])
cv2.polylines(img, np.int32([bbox]), True, (255, 0, 0), 2)
scriptOp.copyNumpyArray(img)
And this works fine, in fact i can see that the qr code is recognized, but i cannot read the data of the qr code, i supposed that print(data) should give me that but i get empty string.
Thanks