1.4.1 • Published 3 days ago

@gutenye/ocr-node v1.4.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 days ago

Guten OCR

Demo | Roadmap

an OCR Javascript library runs on Node.js, Browser, React Native and C++

Based on PaddleOCR and ONNX Runtime, supports PP-OCRv4 model

Getting Started

Node

Example

bun add @gutenye/ocr-node
import Ocr from '@gutenye/ocr-node'
const ocr = await Ocr.create()
const result = await ocr.detect('a.jpg')

Browser

Example

bun add @gutenye/ocr-browser
import Ocr from '@gutenye/ocr-browser'
const ocr = await Ocr.create({
  models: {
    detectionPath: '/assets/ch_PP-OCRv4_det_infer.onnx',
    recognitionPath: '/assets/ch_PP-OCRv4_rec_infer.onnx',
    dictionaryPath: '/assets/ppocr_keys_v1.txt'
  }
})
const result = await ocr.detect('/a.jpg')

React Native

Example

bun add @gutenye/ocr-react-native
import Ocr from '@guenye/ocr-react-native'
const ocr = await Ocr.create()
const result = await ocr.detect('a.jpg')

C++

Example

#include "native-ocr.h"
NativeOcr* ocr = new NativeOcr(..)
auto result = ocr->detect("a.jpg");

API Reference

Ocr.create({
  models?: {
    detectionPath: string
    recognitionPath: string
    dictionaryPath: string
  },
  isDebug?: boolean
  debugOutputDir?: string // Node only
  recognitionImageMaxSize?: number // RN only
  detectionThreshold?: number // RN only
  detectionBoxThreshold?: number // RN only
  detectionUnclipRatiop?: number // RN only
  detectionUseDilate?: boolean // RN only
  detectionUsePolygonScore?: boolean // RN only
  detectionUseDirectionClassify?: boolean // RN only
  onnxOptions?: {}       // Node only. Pass to ONNX Runtime
}): Promise<Ocr>

ocr.detect(imagePath, { 
  onnxOptions?: {}     // Node only. Pass to ONNX Runtime
}): Promise<Result>

Development

  • Requires Git LFS to clone the repo
brew install git-lfs 
git clone git@github.com:gutenye/ocr.git

Related Projects

NamePlatformsNote
eSearch-OCRElectron
paddleocr-onnxNodeRecogination part is incomplete
ocrjsNodeRecogination part is incomplete
Paddle-Lite-DemoMobile, C++
1.4.1

3 days ago

1.4.0

3 days ago

1.3.1

3 days ago

1.3.0

10 days ago

1.2.4

15 days ago

1.2.2

15 days ago

1.2.0

21 days ago

1.2.1

21 days ago

1.0.5

22 days ago

1.0.4

22 days ago

1.0.3

22 days ago

1.0.2

22 days ago

1.0.1

22 days ago

1.0.0

22 days ago