python图像处理之二维码识别(使用opencv接入微信开源模型)

前言
虽然pyzbar挺好用的,但微信、支付宝的二维码识别是真逆天,有木有,很多场景几个开源库识别不了,但是人家就是能识别

Action

一、安装相应的包
如果第一个下好了,第二个要下

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

二、下载模型(下不下都可以,下载使用精度更高)
WeChatCV:WeChatCV

在这里插入图片描述
在这里插入图片描述

下载到之后可以选择跟我一样将文件夹改个名字,我改成了 qr_mode

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.jpg") 
res, points = detector.detectAndDecode(img)

print(res)
print(points)

在这里插入图片描述

不使用模型的情况下的代码

import cv2  
detect_obj = cv2.wechat_qrcode_WeChatQRCode()
img = cv2.imread('QR.jpg')
res,points = detect_obj.detectAndDecode(img)
print('res:',res)
print('points:',points)

欢迎大家点赞或收藏哦~
大家的点赞或收藏可以鼓励作者加快更新哦~

  • 6
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值