当前位置: 首页 > 工具软件 > WeChatQRCode > 使用案例 >

Python 识别二维码: wechat_qrcode_WeChatQRCode

欧阳昊焱
2023-12-01

解决微信生成个性添加好友的二维码,识别不了的情况

依赖包

pip install opencv-python==4.5.2.54 opencv-contrib-python==4.5.2.54  # 只能是这个版本

上才艺

depro = 'test_files/detect.prototxt'
decaf = 'test_files/detect.caffemodel'
srpro = 'test_files/sr.prototxt'
srcaf = 'test_files/sr.caffemodel'

detector = cv2.wechat_qrcode_WeChatQRCode(depro, decaf, srpro, srcaf)  # 这四个参数可以不填,填上是为了识别一张图有多个二维码的情况
image = cv2.imread(file_path)
# 转为灰度图像
# gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
barcodes, points = detector.detectAndDecode(image)  # 使用灰度图像将image换成gray
print(barcodes)
    

模型文件下载地址

 类似资料: