pip install -y pillow -i https://mirrors.aliyun.com/pypi/simple/
pip install -y pyzbar -i https://mirrors.aliyun.com/pypi/simple/
2. 使用
from PIL import Image
# 如果导入报错,安装工具: apt install -y zbar-tools
from pyzbar.pyzbar import decode
def identify_qrcode(img_path):
data = decode(Image.open(img_path))
if len(data) < 1:
return ""
for r in data:
# print("data: {}".format(r))
print("value: {}".format(r.data.decode('utf8')))
print("type: {}".format(r.type))
print("points: {}".format(r.polygon))
导入pyzbar报错
二维码/条形码结果
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)