首页龙虾技能列表 › Doc Scan — 文档扫描工具

Doc Scan — 文档扫描工具

v2.0.0

已弃用。该技能的所有功能已合并到 doc-process (v4.0.0+)。用于文档扫描、透视校正和平面化处理。doc-process 包含改进的扫描引擎,支持多策略边缘检测、子像素角点精炼和扫描质量增强。

0· 270·0 当前·0 累计
by @piyush-zinc·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/6
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
该技能的代码和运行时指令与其声明的用途(本地文档扫描脚本)相匹配;没有证据表明存在无关的凭证访问、网络数据泄露或可疑的安装行为。
评估建议
该技能似乎完全按照其声称的功能运行:运行本地文档扫描脚本。在安装/使用之前,请注意:(1) 它需要 Python 和图像库(opencv-python-headless、numpy、Pillow;img2pdf 可选),你必须在运行时环境中安装这些;(2) SKILL.md 中脚本的路径可能相对于技能的安装方式——请在你的环境中验证脚本路径;(3) 处理是本地的(未观察到网络 I/O),但与任何工具一样,除非你信任运行时环境,否则避免处理高度敏感的文件;(4) 该技能已被弃用,推荐使用 doc-process v4.0.0+,如果可用的话,请优先使用新版本。...
详细分析 ▾
用途与能力
名称/描述(文档扫描、平面化、增强)与附带的脚本(doc_scanner.py)相匹配,该脚本执行边缘检测、透视变换、阴影去除和输出格式化。未请求无关的凭证、服务或二进制文件。
指令范围
SKILL.md 将操作限制在读取提供的图像、运行本地 Python 扫描器并报告结果。它不指导读取无关的文件或环境变量。轻微问题:SKILL.md 使用路径 'python skills/doc-scan/scripts/doc_scanner.py',而清单中列出的是 'scripts/doc_scanner.py'——这可能是一个小的路径约定不匹配,但不表明存在恶意行为。
安装机制
没有安装规范(仅说明并附带脚本)。这是低风险的——没有从外部 URL 下载或执行任何内容。注意:脚本需要 Python 包(opencv-python-headless、numpy、Pillow、可选的 img2pdf);这些不会由技能自动安装。
凭证需求
该技能不请求环境变量、凭证或配置路径。代码不读取环境密钥或网络端点;所有处理都是本地的。所需的包适合图像处理。
持久化与权限
always 为 false;该技能不请求持久/始终开启的权限,也不修改其他技能或系统范围的代理设置。它只运行本地脚本并写入输出文件。
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv2.0.02026/3/5

已弃用:功能已合并到 doc-process v4.0.0。请使用 doc-process 进行所有文档扫描、透视校正和平面化处理。doc-process 扫描器具有改进的多策略边缘检测、子像素角点精炼和更好的扫描质量输出。

● 无害

安装命令 点击复制

官方npx clawhub@latest install doc-scan
镜像加速npx clawhub@latest install doc-scan --registry https://cn.clawhub-mirror.com

技能文档

This skill is deprecated. All functionality has been merged into doc-process v4.0.0 with a significantly improved scanner engine. Please use doc-process instead.
>
To scan a document photo: install doc-process and say "scan this photo", "correct perspective", "dewarp this document", or any equivalent phrase.

# Doc-Scan — Document Scanner Skill (archived)

Converts a photo of a document (whiteboard, printed page, handwritten note, form, receipt, book page, etc.) into a clean scanned-looking image with perspective correction and enhancement.

Step 1 — Validate the Input

Read the provided image visually. Assess:

CheckYes/NoNotes
Is this an image file?.jpg, .jpeg, .png, .heic, .webp, .bmp, .tiff
Does the image contain a document?Printed page, form, note, receipt, whiteboard, book
Is the document the primary subject?Centered or dominant in frame
Is there a perspective distortion?Taken from an angle — not flat/overhead
Is the image quality sufficient?Not severely blurred or too dark

Non-Document Detection

If the image does not appear to contain a document, respond:

⚠ This image doesn't appear to contain a document. I detected: [brief description of what the image contains — e.g., "a landscape photo", "a person's portrait", "a blank wall"]

Doc-Scan works best with:

  • Printed documents (forms, letters, reports)
  • Handwritten notes or whiteboards
  • Receipts, invoices, or business cards
  • Book or magazine pages
  • Any flat document photographed from above or at an angle

If you intended to upload a document photo, please try again with better lighting and the document clearly visible. If you want to process this image for a different purpose, I can help with that instead.

Do not proceed with scanning if this check fails.


Step 2 — Pre-Scan Assessment

Report what you see before scanning:

## Document Photo Assessment

PropertyDetected Value
Document type[e.g., Printed letter, handwritten note, receipt, form]
OrientationPortrait / Landscape / Tilted (~N degrees)
Perspective distortionNone / Mild / Moderate / Severe
LightingEven / Uneven (shadow on [region]) / Too dark / Too bright
BackgroundWhite desk / Dark table / Complex background
Image qualitySharp / Slightly blurred / Blurred
Estimated document area~N% of total image
Multi-page?Single page / [N] pages detected
Content visible[brief description — e.g., "text document, 3 columns, appears to be a form"]
Recommended enhancements:
  • [x] Perspective correction
  • [x] Background removal / edge crop
  • [ ] Binarization (black & white) — suitable if text-only
  • [x] Contrast enhancement
  • [x] Shadow removal
  • [ ] Color preservation — suitable for documents with color content

Step 3 — Run the Scanner Script

python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png

Common Options

# Black and white output (best for text documents)
python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png --mode bw

# Color-preserved output (best for forms, diagrams, colored content) python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png --mode color

# Grayscale output (middle ground) python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png --mode gray

# Output as PDF python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.pdf --format pdf

# Multiple images into one PDF (multi-page scan) python skills/doc-scan/scripts/doc_scanner.py --input page1.jpg page2.jpg page3.jpg --output document.pdf --format pdf

# Manual corner specification (if auto-detection fails) python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png --corners "50,30 800,20 820,1100 40,1120"

# High-resolution output python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png --dpi 300

# Skip perspective correction (if photo is already flat) python skills/doc-scan/scripts/doc_scanner.py --input photo.jpg --output scanned.png --no-warp


Step 4 — Interpret Script Output

The script outputs a JSON status block to stderr. Parse and report to user:

{
  "status": "success",
  "corners_detected": true,
  "corners": [[50,30],[800,20],[820,1100],[40,1120]],
  "warp_applied": true,
  "enhancement_mode": "bw",
  "input_size": [3024, 4032],
  "output_size": [2480, 3508],
  "output_dpi": 300,
  "pages": 1,
  "output_file": "scanned.png",
  "warnings": []
}

Status Handling

"status": "success": Report completion with key stats.

"corners_detected": false: Auto-detection failed. Offer:

  • "Auto edge-detection could not find the document corners. I can try with manual corner hints — please describe approximately where the four corners of the document appear in the photo (e.g., top-left at about 10% from left and 5% from top)."
  • Or: offer --no-warp mode to at least apply enhancement without perspective correction

warnings array: Report any warnings to user — e.g., "Low contrast image", "Detected significant blur", "Partial document visible"


Step 5 — Post-Scan Quality Check

After the script completes, read the output image visually and assess:

Quality CheckPass / FailNotes
Document edges are straightNo barrel distortion remaining
Text is legibleNot blurred or over-enhanced
Shadows removed or reducedEven lighting across page
Background removed (white/clean)No table/desk visible
Correct aspect ratio (A4/Letter)Not stretched or squished
Color / binarization correctB&W if text-only, Color if content requires it
If any check fails, report the issue and offer:
  • Re-run with different settings (different mode, manual corners, contrast level)
  • Re-photograph tips (see Step 7)

Step 6 — Output Report

## Scan Complete ✓

PropertyValue
Output filescanned.png
Output size2480 × 3508 px (A4 at 300 DPI)
ModeBlack & White
Perspective correctionApplied
Shadow removalApplied
Processing time~2.3s

Enhancements Applied

  • Edge detection and four-corner extraction
  • Perspective warp to standard A4 dimensions
  • Adaptive thresholding (Sauvola method) for clean B&W text
  • Shadow compensation via background normalization
  • Border cropped to document edges

Before → After

[Original photo] → [Scanned output] (Both are available at their file paths)


Step 7 — Multi-Page Documents

If the user provides multiple photos (or a folder of images):

  • Process each image individually
  • Sort by filename or user-specified order
  • Combine into a single PDF:
python skills/doc-scan/scripts/doc_scanner.py \
  --input page1.jpg page2.jpg page3.jpg \
  --output document.pdf --format pdf
  • Report: "3-page document scanned and saved to document.pdf"

For very large batches (10+ pages), process in batches of 10 and combine.


Step 8 — Photography Tips (on poor quality input)

If the input image quality is poor or auto-detection fails, provide tips:

### Tips for Better Scans

Lighting:

  • Scan in bright, even lighting (avoid direct sunlight creating glare)
  • Avoid shadows from your hand or body
  • A well-lit indoor environment works well

Camera position:

  • Hold the camera directly above the document when possible
  • Keep the camera parallel to the document surface
  • The full document should be visible with a small border around it

Background:

  • Place the document on a contrasting background (dark table for white paper, white surface for dark paper)
  • Avoid patterned or busy backgrounds

Focus & stability:

  • Tap to focus on the document before taking the photo
  • Hold steady or use a tripod for sharper results
  • Use the highest resolution available on your camera

Document preparation:

  • Flatten any folds or curves
  • If the document is creased, press it flat before photographing

Step 9 — Integration with Doc-Process

After a successful scan, offer to process the scanned document with doc-process:

Scan complete! Would you also like me to:
  • Extract text and fill a form from this scanned document?
  • Analyze this as a contract/receipt/medical document?
  • Translate this document to another language?
  • Extract tables from this document?

Just say what you'd like to do and I'll process the scanned version.

If the user confirms, pass the scanned output file to the appropriate doc-process mode.


Step 10 — Timeline Logging

After a successful scan, silently log to the timeline:

python skills/doc-process/scripts/timeline_manager.py add \
  --type "Doc Scan" \
  --source "" \
  --summary " page(s) scanned, perspective corrected, saved as "

General Rules

  • Never process the photo if it does not contain a document — explain what was detected instead
  • Always report the detected document type so the user can confirm before scanning
  • Auto-detect corners when possible; fall back gracefully to manual or no-warp mode
  • Default output mode: bw for text documents, color for anything with color content
  • Default output format: PNG (lossless); PDF only if explicitly requested or for multi-page
  • Default DPI: 300 (print quality); 150 for screen-only use
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务