360 Secure SkillHub
360 安全技能中心

Ocr Scanner

该技能提供独立 OCR 能力,从 JPG/PNG/WEBP 图片中提取文字,支持德语和英语;以 EasyOCR 为主引擎,必要时回退 Tesseract,支持灰度与对比度等可选预处理、异步并发处理与日志。Telegram、Discord 机器人集成为可选,需显式配置对应令牌。

kaarl92
kaarl92
热度 20.10
最近更新 2026-03-20 11:01:50
分类:效率依赖:代码执行 / 读写文件 / 第三方 API应用场景:数据处理 / 文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add ocr-scanner
Metadata
name
ocr
version
1.0.1
description
Standalone OCR capability (EasyOCR/Tesseract) with optional Telegram and Discord bot integrations. Extracts text from JPG/PNG/WEBP images, supports German & English. Bot integrations require explicit env vars.
metadata
{"openclaw":{"emoji":"🔍","category":"utility","optional-config":[{"name":"TELEGRAM_BOT_TOKEN","description":"Telegram Bot API token (required for telegram_bot)"},{"name":"DISCORD_BOT_TOKEN","description":"Discord Bot token (required for discord_bot)"}]}}
allowed-tools
["message"]

OCR Skill

This skill provides stand‑alone OCR functionality without any Telegram or Discord bot integrations. It can be used by other agents via the core ocr_core.py module.

Features

  • Supports JPG, PNG, WEBP.
  • Languages: German (de) and English (en) (easy to extend).
  • Uses EasyOCR as primary engine, falls back to Tesseract when needed.
  • Optional pre‑processing (grayscale, contrast‑enhancement) for noisy scans.
  • Fully async – multiple simultaneous requests are handled without blocking.
  • Clean error handling & logging.

Structure

ocr/
├─ SKILL.md               # this file
├─ HEARTBEAT.md           # optional periodic health check
├─ package.json           # metadata for ClawHub
├─ main.py                # optional entry‑point (can be omitted)
├─ ocr_core.py            # core OCR logic, importable by other agents
├─ ocr_engine.py          # wrapper for EasyOCR/Tesseract
└─ utils.py               # download / cleanup helpers

Setup & Deployment

  1. Install system dependencies – Tesseract is required for the fallback engine:
    sudo apt-get update && sudo apt-get install -y tesseract-ocr libtesseract-dev   # Debian/Ubuntu
    # or on macOS: brew install tesseract
    
  2. Create a virtual environment (recommended):
    cd /root/.openclaw/workspace/ocr
    python3 -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
    
  3. Start the skill – you can run the optional entry point if you need a simple CLI:
    python -m ocr.main
    
    Or import the core directly from other agents:
    from ocr.ocr_core import OCR
    text = OCR().process_image("/path/to/image.jpg")
    
  4. Test – call the core function with any supported image file and verify the extracted text.