1 Star 0 Fork 0

LG_Olxjdqj / pyzxing

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

pyzxing

简体中文 | English

Travis (.org) GitHub release (latest by date including pre-releases) PyPI Codacy grade

Pyzxing是二维码识别ZXingJAVA库的Python API。由于Zxing库相较于其他库二维码识别率最高,但使用起来十分繁琐,且python-zxing不能正常使用缺已不再维护,所以我创建了这个库让使用Python的人可以以最小的精力来使用Zxing库来进行二维码识别。

特性

  • 十分容易上手
  • 结构化输出
  • 能够识别一张图中的多个二维码
  • 以并行方式识别多张图片,提速77%

安装

推荐从Github源安装:

git clone https://github.com/ChenjieXu/pyzxing.git
cd pyzxing
python setup.py install

同时也支持使用pip从 PyPI安装:

pip install pyzxing

构建ZXing库

随版本提供了一个即用的jar文件,但我不能保证此文件将在您的电脑上正常工作。可以在构建ZXing之前运行测试脚本。Pyzxing将自动下载编译的Jar文件并调用单元测试。对于尚未安装Java的用户,强烈建议您安装openjdk8。

python -m unittest src.test_decode

如果单元测试未通过,使用以下代码构建ZXing库:

git submodule init
git submodule update
cd zxing
mvn install -DskipTests
cd javase
mvn -DskipTests package assembly:single

快速上手

from pyzxing import BarCodeReader
reader = BarCodeReader()
results = reader.decode('/PATH/TO/FILE')
# 支持输入文件模式以检测多个文件
results = reader.decode('/PATH/TO/FILES/*.png')
print(results)
# 支持传入图片的向量
# 需要额外安装opencv,pip install opencv-python
results = reader.decode_array(img)

或者直接从命令行调用:

python scanner.py -f /PATH/TO/FILE

赞助

Logo
开源支持计划

MIT License Copyright (c) 2020 Chenjie Xu Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
Python
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/olxjdqj/pyzxing.git
git@gitee.com:olxjdqj/pyzxing.git
olxjdqj
pyzxing
pyzxing
master

搜索帮助