python识别二维码方法2-使用库opencv-python

安装第三方库

 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请求,取返回值即可获取到想要的结果

 

posted @ 2023-07-06 17:40  sunshine阿星  阅读(150)  评论(0)    收藏  举报