tims-ocr-api

OCR for TIMS-server API


Keywords
ocr, tims
License
MIT
Install
npm install tims-ocr-api@3.0.2

Documentation

TIMS-OCR-API For Nodejs

NPM version Build Status Coveralls Status

Downloads

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识别输入和输出

ocr example

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

ocr_srv API

OCR server socket API

License MIT