UNPKG

@gutenye/ocr-react-native

Version:

Guten OCR is a high accurate text detection (OCR) Javascript/Typescript library that runs on Node.js, Browser, React Native and C++. Based on PaddleOCR and ONNX runtime

16 lines (13 loc) 422 B
import OcrModule from './OcrModule' import type { OcrOptions, TextLine } from './types' export class Ocr { // default options is at shared.h static async create(options: OcrOptions): Promise<Ocr> { await OcrModule.create(options) return new Ocr() } detect(rawImagePath: string): Promise<TextLine[]> { const imagePath = rawImagePath.replace('file://', '') return OcrModule.detect(imagePath) } }