123weizheng / tr

Free Offline OCR 离线的中文文本检测+识别SDK

Home Page:https://github.com/myhub/tr

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tr - Text Recognition

一款针对扫描文档的离线文本识别SDK,核心代码全部采用C++开发,并提供Python接口

更新说明

  • 添加python2支持
  • 去除opencv-python、Pillow依赖,降低部署难度
  • 支持多线程

如果喜欢本软件,打开支付宝扫一扫,您的赞助是我们开发的最大动力
点击查看图片
已有4人共赞助46元~

Contact

Email: anycode@yahoo.com

Requirements

  • python2/python3
  • Ubuntu 16.04/Ubuntu 18.04
  • numpy

Install

  • 安装方法一
git clone https://github.com/myhub/tr.git
cd ./tr
sudo python setup.py install
  • 安装方法二
sudo pip install git+https://github.com/myhub/tr.git@master

Test

python2 demo.py               # python2兼容测试     
python3 test.py               # 可视化测试
python3 test-multi-thread.py  # 多线程测试

关联项目

  • 若需要Web端调用,推荐参考TrWebOCR

How To Use?

import tr

# detect text lines, return list of (cx, cy, width, height, angle)
print(tr.detect("imgs/web.png", tr.FLAG_RECT))

# detect text lines with angle, return list of (cx, cy, width, height, angle)
print(tr.detect("imgs/id_card.jpeg", tr.FLAG_ROTATED_RECT))

# recognize text line, return (text, confidence)
print(tr.recognize("imgs/line.png"))

# detect and recognize text lines with angle, return list of ((cx, cy, width, height, angle), text, confidence)
print(tr.run("imgs/id_card.jpeg"))

效果展示


About

Free Offline OCR 离线的中文文本检测+识别SDK

https://github.com/myhub/tr

License:GNU Affero General Public License v3.0


Languages

Language:Python 100.0%