Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

paddleocrjson

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paddleocrjson

基于 https://github.com/hiroi-sora/PaddleOCR-json 的node.js api

  • 1.1.1-a
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

PaddleOCR-json-node-api

基于hiroi-sora/PaddleOCR-json的node.js api.

Log

v1.1.0 2023.5.2

适配 hiroi-sora/PaddleOCR-json v1.3.0 Alpha.1

(v1.2 回退 paddleocrjson@1.0.11-a)

v1.0.8 2023.1.20

---

v1.0.7 2022.11.8

---

v1.0.6 2022.11.8

OCR.postMessageOCR.flush区别开.

使监听的数据与OCR.flush返回的数据一致.

优化动态参数中关于路径的字段.

使用npm包管理.

使用ts编译.

v1.0.5 2022.10.12

---

v1.0.4 2022.10.1

适配hiroi-sora/PaddleOCR-json v1.2.1.

不使用iconv-lite包.

更改启动参数输入方式.

v1.0.3 2022.10.1

适配hiroi-sora/PaddleOCR-json v1.2.1.

v1.0.2 2022.9.14

增加环境选项.

v1.0.1 2022.9.14

修复无法识别 Alpha版 的启动完成标志的bug. JSON输入更改为ascii转义.

v1.0.0 2022.9.10

---

快速开始

OCR api

npm install paddleocrjson
const OCR = require('paddleocrjson');

const OCR = require('paddleocrjson/es5'); // ES5

const ocr = new OCR('PaddleOCR-json.exe', [/* '-port=9985', '-addr=loopback' */], {
    cwd: './PaddleOCR-json',
}, /* debug */true);

ocr.flush({ image_path: 'path/to/test/img' })
    .then((data) => console.log(data));
    .then(() => ocr.terminate());

// debug = true
ocr.stdout.on('data', (chunk) =>{
    console.log(chunk.toString());
});
ocr.stderr.on('data', (data) =>{
    console.log(data.toString());
});
ocr.on('exit', (code) =>{
    console.log('exit code: ', code);
});

server服务

详见PunchlY/PaddleOCR-json-node-api/test.

api

OCR

OCRworker_threads.Worker的派生类.

new OCR(path, args, options, debug)
const ocr = new OCR('PaddleOCR_json.exe', [], {
    cwd: './PaddleOCR-json',
}, false);

args详见Node.js child_process.spawnhiroi-sora/PaddleOCR-json#配置参数说明.

options详见Node.js child_process.spawn.

OCR.flush(obj)
ocr.flush({
    /* image_path: null, // -image_path=clipboard */
    image_path: 'path/to/test/img',
    // limit_side_len: 960,
    // ...
});

ocr.flush返回的是Promise对象.

obj详见hiroi-sora/PaddleOCR-json/blob/main/docs/详细使用指南.md#配置参数

如果要识别剪贴板,请传入{ image_path: null }(obj.image_dir设置为null).

其他

你可以用worker_threads.Worker的api来监听或操作OCR实例.

例如:

ocr.on('init', (pid, addr, port) => {
    console.log('OCR init completed.');
    console.log('pid:', pid);
    console.log('addr:', addr);
    console.log('port:', port);
});

ocr.on('message', (data) => {
    console.log(data);
    // { code: ..., message: ..., data: ... }
});

License

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
                    Version 2, December 2004

 Copyright (C) 2023 PunchlY

 Everyone is permitted to copy and distribute verbatim or modified
 copies of this license document, and changing it is allowed as long
 as the name is changed.

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

  1. You just DO WHAT THE FUCK YOU WANT TO.

Keywords

FAQs

Package last updated on 31 Aug 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc