Skip to main content

本地轻量级OCR识别工具

Project description

本地轻量级OCR识别工具

基于 RapidOCR + ONNX Runtime 的本地OCR工具,极速识别(~1秒/张)、低资源占用(<300MB)、完全离线。

✨ 特性

  • ✅ 极速识别 (~1秒/张)
  • ✅ 低资源占用 (<300MB)
  • ✅ 高准确率 (中文99.5%, 英文99%+)
  • ✅ 完全离线 (保护隐私)
  • ✅ 批量处理 (多线程)
  • ✅ 多种输出 (TXT/JSON/MD/HTML/CSV)
  • ✅ 跨平台 (Windows/Linux/Mac)

📦 安装

pip install rapid-ocr-tool

🚀 使用

⚠️ 平台差异说明:

  • Linux/Mac: 安装后可直接使用 ocr 命令
  • Windows: 由于系统限制无法直接使用 ocr 命令,需使用以下方式之一:
    1. 使用 python -m main 方式(推荐,所有平台通用)
    2. 配置 PowerShell 函数实现 ocr 命令(见下方)

Linux/Mac

# 安装后直接使用简短命令
ocr image photo.jpg
ocr batch ./photos --output ./results

Windows

方式一: 通用命令 (推荐):

python -m main image photo.jpg
python -m main batch ./photos --output ./results

方式二: 配置OCR命令 (PowerShell):

  1. 编辑PowerShell配置文件:
notepad $PROFILE
  1. 添加以下内容:
function ocr {
    $ocrDir = "D:\z_code\code\tools\ocr"  # 改为你的路径
    if (Test-Path $ocrDir) {
        Push-Location $ocrDir
        try { python -m main @args }
        finally { Pop-Location }
    }
}
  1. 重新加载配置:
. $PROFILE
  1. 现在可以直接使用:
ocr image photo.jpg

📋 常用命令

💡 提示: Windows用户请将下方命令中的 ocr 替换为 python -m main

# 识别单张图片
ocr image photo.jpg

# 批量处理
ocr batch ./photos --output ./results

# 指定输出格式
ocr image photo.jpg --format json
ocr image photo.jpg --format txt
ocr image photo.jpg --format md

# 保存结果
ocr image photo.jpg --output result.txt

# 英文识别
ocr image english.jpg --lang en

# 查看帮助
ocr --help
ocr image --help

🎯 可用命令

  • image - 识别单张图片
  • batch - 批量处理文件夹
  • info - 显示图片信息
  • preprocess - 图像预处理

📂 支持的格式

  • PNG (.png)
  • JPEG (.jpg, .jpeg)
  • BMP (.bmp)
  • TIFF (.tiff, .tif)

🔧 技术栈

  • OCR引擎: RapidOCR
  • 推理框架: ONNX Runtime
  • 模型: PP-OCRv3 (12.3MB)

📄 许可证

MIT License

🙏 致谢


版本: 1.1.1 | PyPI: rapid-ocr-tool

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rapid_ocr_tool-1.1.1.tar.gz (31.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rapid_ocr_tool-1.1.1-py3-none-any.whl (16.6 kB view details)

Uploaded Python 3

File details

Details for the file rapid_ocr_tool-1.1.1.tar.gz.

File metadata

  • Download URL: rapid_ocr_tool-1.1.1.tar.gz
  • Upload date:
  • Size: 31.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for rapid_ocr_tool-1.1.1.tar.gz
Algorithm Hash digest
SHA256 b52496d9ea6af77202e55d9d856a67acd2cbe9724504f4811d31bea58d1ae224
MD5 aeddaf345ec3a4a479bbcedde0d4bb53
BLAKE2b-256 4d4b24132db000e52396c41d8d41a97e2b1e29b492e6086643be5d0509835079

See more details on using hashes here.

File details

Details for the file rapid_ocr_tool-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: rapid_ocr_tool-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 16.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for rapid_ocr_tool-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 14e65702ab775d1143c093b3704f68a71f978b2d1da63cc7a4a1deaeece02f05
MD5 6f0306b8a50c1d24810f0246639d2cbc
BLAKE2b-256 98ed399de60a7423b35a1e1f1f1ad02e67b31e13b70356a3b0fe7bbfd18f1b49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page