# @gutenye/ocr-browser 中文文档

规范地址：https://npmcn.com/package/%40gutenye/ocr-browser/

版本：1\.4\.9
npm 元数据更新时间：2026-09-19T11:55:37.418Z
中文译文更新时间：2026-11-17T04:04:49.742Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40gutenye/ocr-browser
原文对照：https://npmcn.com/package/%40gutenye/ocr-browser/?lang=original
项目主页：https://github.com/gutenye/ocr#readme
源码仓库：https://github.com/gutenye/ocr

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：18.7 kB，14 个文件
- 模块格式：ES Module
- TypeScript 类型：未声明
- 运行依赖：3 个
- 首次发布：2024-05-01T07:46:31.098Z
- 最新版本发布：2026-09-19T11:55:37.289Z
- 近 30 天下载量：30690（2026-10-17 至 2026-11-15，npm 官方下载统计）
- 已发布版本数：14（近 12 个月 1 个）

## 中文简介

Guten OCR是一个高精度的文本检测(OCR)Javascript/Typescript库,运行于Node.js,浏览器,React Introduct和C++上. 基于 PaddleOCR 和 ONNX 运行时间

## 安装

```sh
npm install @gutenye/ocr-browser
```

也可以使用：`pnpm add @gutenye/ocr-browser`、`yarn add @gutenye/ocr-browser`、`bun add @gutenye/ocr-browser`

## README

# 古腾 OCR

> [演示](https://gutenye-ocr.netlify.app/) | [路线图](https://github.com/users/gutenye/projects/5/views/4)

**oCR Javascript 库运行于 Node.js, 浏览器, React Introduct 和 C++**

依据 [弹出](https://github.com/PaddlePaddle/PaddleOCR) 财务报告和审定财务报表 [ONNX 运行时间](https://github.com/microsoft/onnxruntime),支持 PP-OCRv4 模式

## 开始

### 节点

> [示例](https://npmcn.com/package/%40gutenye/ocr-browser/packages/node/example/README.md)

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

### 浏览器

> [示例](https://npmcn.com/package/%40gutenye/ocr-browser/packages/browser/example/README.md)

```ts
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')
```

### 原生反应

> [示例](https://npmcn.com/package/%40gutenye/ocr-browser/packages/react-native/example/README.md)

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

### C++ 组合

> [示例](https://npmcn.com/package/%40gutenye/ocr-browser/packages/react-native/cpp/example/README.md)

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

### API 参考

```ts
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
  useDirectionClassify?: boolean // RN only
  onnxOptions?: {}       // Node only. Pass to ONNX Runtime
}): Promise<Ocr>

ocr.detect(imagePath: string | {data: Uint8Array | Uint8ClampedArray | Buffer, width: number, height: number}, {
  onnxOptions?: {}     // Node only. Pass to ONNX Runtime
}): Promise<{texts: TextLine[], resizedImageWidth: number, resizedImageHeight: number}>

TextLine {
  text: string
  score: number
  frame: { top, left, width, height }
}

```

## 发展

-   需要 Git LFS 来克隆 repo

```sh
brew install git-lfs 
git clone git@github.com:gutenye/ocr.git
```

-   [发展](https://npmcn.com/package/%40gutenye/ocr-browser/docs/Development.md)

## 相关项目

| 名称 | 平台 | 说明 |
| --- | --- | --- |
| [电子搜索-OCR](https://github.com/xushengfeng/eSearch-OCR) | 电子 |  |
| [相接桨](https://github.com/backrunner/paddleocr-onnx) | 节点 | 复算部分不完整 |
| [欧克雷斯](https://github.com/SOVLOOKUP/ocrjs) | 节点 | 复算部分不完整 |
| [划板- 点- 点](https://github.com/PaddlePaddle/Paddle-Lite-Demo) | 移动, C++ |  |

## 许可证

这个项目的源代码根据 [麻省理工学院](https://npmcn.com/package/%40gutenye/ocr-browser/LICENSE) 执照.

模型和字典资产 `packages/models/assets` 为: **没有** 麻省理工学院的执照 他们来自 [弹出](https://github.com/PaddlePaddle/PaddleOCR) 并一直处于 [阿帕奇 - 2.0](https://github.com/PaddlePaddle/PaddleOCR/blob/main/LICENSE) 执照.

## 常见问题

### @gutenye/ocr-browser 是什么？

Guten OCR是一个高精度的文本检测\(OCR\)Javascript/Typescript库,运行于Node\.js,浏览器,React Introduct和C\+\+上\. 基于 PaddleOCR 和 ONNX 运行时间

### 如何安装 @gutenye/ocr-browser？

在项目目录运行 npm install @gutenye/ocr-browser，或使用 pnpm add / yarn add / bun add。

### @gutenye/ocr-browser 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/gutenye\_\_ocr-browser 是否存在。

### @gutenye/ocr-browser 支持 ESM 还是 CommonJS？

以 ES Module 形式发布，推荐使用 import 引入。在 CommonJS 项目中，Node\.js 20\.19\+ / 22\.12\+ 可以直接 require\(\) 不含顶层 await 的 ES Module，更早的版本需要改用动态 import\(\)。

### @gutenye/ocr-browser 可以商用吗？

@gutenye/ocr-browser 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @gutenye/ocr-browser 的下载量有多少？

根据 npm 官方下载统计，@gutenye/ocr-browser 在 2026/10/17 – 2026/11/15 这 30 天内被下载 30,690 次，日均约 1,023 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @gutenye/ocr-browser 还在维护吗？

最新版本 1\.4\.9 发布于 2026/09/19（1 个月前）；至今共发布 14 个版本，其中过去 12 个月发布了 1 个；首次发布于 2024/05/01。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

