My code can read QR but not 2D code (datamatrix)

68 Views Asked by At

I am using the code below to decode code from an image. This works fine with a QR code but not with a 2D datamatrix.

def read_qr_code(filename):
    try:
        img = cv2.imread(filename)
        detect = cv2.QRCodeDetector()
        value, points, straight_qrcode = detect.detectAndDecode(img)
        return value
    except:
        print ('Error')
        return
read_qr_code('single.jpg')

How can I change it to decode 2D code?

0

There are 0 best solutions below