python识别二维码方法2-opencv-python

发布时间 2023-07-06 17:48:28作者: sunshine阿星

安装第三方库

 pip3 install opencv-python

 

def scan_QR_opencv():
    file_path = './file/data/screenshot.png'
    QR_image = cv2.imread(file_path)
    QR_detector = cv2.QRCodeDetector()
    data, bbox, straight_qrcode = QR_detector.detectAndDecode(QR_image)
    print(data)
对data进行post请求,取返回值即可获取到想要的结果