python opencv使用微信开源模型识别二维码

微信二维码引擎OpenCV开源!3行代码让你拥有微信扫码能力

第一步,确认环境

pip install opencv-python
pip install opencv-contrib-python

第二步,下载模型

WeChatCV GutHub: link
备用地址: link

第三步,识别二维码

import cv2
from cv2.wechat_qrcode import WeChatQRCode

detector = WeChatQRCode(detector_prototxt_path="qr_mode/detect.prototxt", detector_caffe_model_path="qr_mode/detect.caffemodel",super_resolution_prototxt_path="qr_mode/sr.prototxt", super_resolution_caffe_model_path="qr_mode/sr.caffemodel")
img = cv2.imread("qr.png") # cv2.imdecode() 读取文件流或图像数据的NumPy数组
res, points = detector.detectAndDecode(img)

print(res, points)

示例二维码
在这里插入图片描述

输出结果

('{"s":"urs","a":"login","l":{"p":"cbg","i":"e13dfbb8b45968a4bc6f415698f7983c"}}',) (array([[ -0.1800601 ,  -0.1800601 ],
       [155.20001   ,  -0.20000002],
       [155.39137   , 155.39137   ],
       [ -0.20000002, 155.20001   ]], dtype=float32),)
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值