tims-ocr-api
v3.2.0
Published
OCR for TIMS-server API
Downloads
13
Readme
TIMS-OCR-API For Nodejs
intro
TIMS OCR提供两种接口:
- Socket
- HTTP(已废弃)
将Socket接口封装成OCR.scan()
这样的Node.js接口。
API Document: https://yyssc.github.io/tims-ocr-api/jsdoc/
Advantages
- 支持本地图片 外部图片(速度取决图片大小)
- 用扫描仪扫描出的发票,识别率基本能达到 95%
- 支持 shell/nodejs 全局安装可在控制台直接运行
- bluebird/promise 接口操作灵活
识别发票类型
- 增值税专用发票(票样)
依赖
- 安装
ocr_srv
并启动./start.sh
Install & Usage
1. Global
npm install tims-ocr-api -g
ocr --help
# 远程图片
ocr http://7pun4e.com1.z0.glb.clouddn.com/test.jpg
# 本地图片
ocr ./test.jpg
OCR识别输入和输出
2. Nodejs
npm install tims-ocr-api --save
FYI examples
var host = '127.0.0.1';
var port = '39456';
var ocr = require('tims-ocr-api').create(host, port);
// 本地图片
ocr.upload('/tmp/test.jpg').then(function (result) {
return console.log(result)
}).catch(function (err) {
console.log('err', err);
})
Run UnitTest
make test
DEBUG=* make test # show debug log
mocha --ui tdd -g 'utils' # only test 'utils', and use TDD interface
make cov # Coverage rate
Note: travis-ci.org will run this test https://travis-ci.org/yyssc/tims-ocr-api
Build API document
grunt [jsdoc]
Publish API doc to github project pages
The generated API document is located in out/
dir.
.utility/push-jsdoc-to-gh-pages.sh
will called when travis-ci finished Unittest, to push out/
dir to branch gh-pages
of current repo.
TODO: out/
should generated automatically.
Mock server
You could use a mock test for testing.
https://github.com/yyssc/mock-tims-ocr
test data
- 增值税专用发票 https://drive.google.com/drive/folders/0B_RIK8efdyq-VmZqMUJOaTVtVm8