Xpersona
I

Image Recognition

CLAWHUB · Unverified

图片识别 - 通用图片识别技能,支持 OCR 文字提取、物体识别、场景分析等。自动使用用户配置的视觉模型,适用于 Android/Termux 环境。 Skill: Image Recognition Owner: wangning823-arch Summary: 图片识别 - 通用图片识别技能,支持 OCR 文字提取、物体识别、场景分析等。自动使用用户配置的视觉模型,适用于 Android/Termux 环境。 Tags: latest:1.1.0 Version history: v1.1.0 | 2026-04-01T11:17:12.220Z | auto - Added automatic model provider detection: now supports Bailian, OpenRouter, and other OpenAI-compatible visual models by reading configuration or environment variables. - Updated documentation with new provi

62
Rank
84
Safety
1.8k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.8K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17c4c2xngpzh3s3d4azm4830n8402cw:image-recognition
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-wangning823-arch-image-recognition/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

21,904 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: image-recognition
description: "图片识别 - 通用图片识别技能,支持 OCR 文字提取、物体识别、场景分析等。自动使用用户配置的视觉模型,适用于 Android/Termux 环境。"
homepage: https://clawhub.ai/skills/image-recognition
version: 1.0.0
author: 小 MIX
changelog: "Initial release: Android/Termux 图片识别技能,自动使用用户配置的视觉模型,绕过 sharp 模块限制"
metadata: { "openclaw": { "emoji": "👁️", "requires": { "python": ["requests", "Pillow"] } } }
---

# Image Recognition Skill (图片识别)

**适用于 Android/Termux 环境的图片识别技能**

## 何时使用

✅ **使用此技能:**

- "识别这张图片"
- "图片里有什么"
- "提取图片中的文字"
- OCR 文字识别
- 物体/场景识别
- 截图内容分析

❌ **不使用此技能:**

- 用户明确要求用其他 OCR 服务
- 图片文件不存在或损坏

## 技术原理

**核心方法:**
1. 读取图片文件为二进制
2. Base64 编码
3. 调用用户配置的视觉模型 API
4. 返回识别结果

**为什么不用 sharp:**
- `sharp` 模块在 Termux (Android arm64) 无法加载
- 直接使用 Python + requests 调用 API 更稳定

**支持的模型提供商:**
- ✅ Bailian (通义千问) - `qwen3.5-plus`, `qwen-vl-max`
- ✅ OpenRouter - 支持视觉的模型
- ✅ 其他 OpenAI 兼容接口 - 支持 `image_url` 格式的模型

## 配置

### 方式一:使用 OpenClaw 配置的模型(推荐)

脚本会自动读取 OpenClaw 的配置文件 `~/.openclaw/openclaw.json`,使用已配置的模型和 API Key。

**无需额外配置!** 只要你的 OpenClaw 配置了支持视觉的模型即可。

### 方式二:手动配置环境变量

```bash
# Bailian (通义千问)
export IMAGE_MODEL_PROVIDER="bailian"
export IMAGE_MODEL_API_KEY="sk-sp-xxxxxxxxxxxxx"
export IMAGE_MODEL_NAME="qwen3.5-plus"
export IMAGE_MODEL_ENDPOINT="https://coding.dashscope.aliyuncs.com/v1/chat/completions"

# OpenRouter
export IMAGE_MODEL_PROVIDER="openrouter"
export IMAGE_MODEL_API_KEY="sk-or-xxxxxxxxxxxxx"
export IMAGE_MODEL_NAME="qwen/qwen-2.5-vl-72b-instruct"
export IMAGE_MODEL_ENDPOINT="https://openrouter.ai/api/v1/chat/completions"
```

### Python 依赖

```bash
pip3 install requests Pillow
```

## 使用方法

### 方式一:自动检测(推荐)

脚本会自动读取 OpenClaw 配置文件,使用已配置的**支持视觉的模型**。

```bash
python3 ~/.openclaw/skills/image-recognition/recognize.py /path/to/image.jpg
```

**无需额外配置!** 只要你的 OpenClaw 配置了支持视觉的模型(如 `qwen3.5-plus`)即可。

### 方式二:手动指定环境变量

```bash
# Bailian (通义千问)
export IMAGE_MODEL_PROVIDER="bailian"
export IMAGE_MODEL_API_KEY="sk-sp-xxxxxxxxxxxxx"
export IMAGE_MODEL_NAME="qwen3.5-plus"

# OpenRouter
export IMAGE_MODEL_PROVIDER="openrouter"
export IMAGE_MODEL_API_KEY="sk-or-xxxxxxxxxxxxx"
export IMAGE_MODEL_NAME="qwen/qwen-2.5-vl-72b-instruct"

# 使用
python3 recognize.py /path/to/image.jpg
```

### 方式三:在 Python 代码中使用

```python
from recognize import recognize_image, get_model_config

# 自动检测配置
config = get_model_config()
print(f"使用模型:{config['provider']}/{config['model']}")

# 识别图片
result = recognize_image("/path/to/image.jpg", "提取图片中的文字")
print(result)

# 或手动指定配置
custom_config = {
    "provider": "bailian",
    "api_key": "sk-sp-xxx",
    "model": "qwen3.5-plus",
    "endpoint": "https://coding.dashscope.aliyuncs.com/v1/chat/completions",
    "headers": {"Authorization": f"Bearer sk-sp-xxx"}
}
result = recognize_image("/path/to/image.jpg", config=custom_config)
```

## API 配置(高级)

**大多数用户不需要手动配置**,脚本会自动使用 OpenClaw 的模型配置。

### 自动检测逻辑

1. **优先使用环境变量**(如果设置了)
2. **其次读取 OpenClaw 配置**(`~/.openclaw/openclaw.json`)
3. **最后使用默认配置**(Bailian qwen3.5-plus)

### 手动配置各提供商

#### Bailian (通义千问)

```

README.md

# Image Recognition Skill

图片识别技能 - 使用通义千问视觉模型识别图片内容

## 快速开始

### 1. 安装依赖

```bash
pip3 install requests Pillow
```

### 2. 配置 API Key(可选)

默认已配置,如需修改:

```bash
export BAILIAN_API_KEY="sk-sp-your-api-key"
```

### 3. 使用

```bash
# 识别图片
python3 recognize.py /path/to/image.jpg

# 指定问题
python3 recognize.py /path/to/image.jpg "提取图片中的所有文字"
```

## 在 OpenClaw 中集成

### 方法一:作为外部命令调用

```python
import subprocess

result = subprocess.run(
    ["python3", "~/.openclaw/skills/image-recognition/recognize.py", image_path],
    capture_output=True,
    text=True
)
print(result.stdout)
```

### 方法二:直接导入函数

```python
from recognize import recognize_image

result = recognize_image("/path/to/image.jpg")
print(result)
```

## 文件说明

- `SKILL.md` - 技能说明文档
- `recognize.py` - 主脚本
- `README.md` - 本文件
- `usage-guide.md` - 使用指南(可选)
- `examples/` - 示例(可选)

## 支持的图片格式

- JPEG/JPG
- PNG
- GIF(静态)
- WebP
- BMP

## API 端点

**正确端点:**
```
https://coding.dashscope.aliyuncs.com/v1/chat/completions
```

## 模型

- `qwen3.5-plus` - 默认,支持视觉
- `qwen-vl-max` - 专业视觉模型(需要单独开通)

## 故障排除

### API Key 无效

检查:
1. API Key 是否正确(`sk-sp-` 开头)
2. 端点是否正确(`coding.dashscope.aliyuncs.com`)
3. API Key 是否已开通视觉模型权限

### 图片太大

建议压缩到 2MB 以内,或调整分辨率。

### 识别不准确

- 确保图片清晰
- 文字不要太模糊
- 尝试调整问题提示

## 更多信息

查看 `SKILL.md` 获取完整文档。

_meta.json

{
  "ownerId": "kn72wtym84qvy0g0mdtsa3h6ks841610",
  "slug": "image-recognition",
  "version": "1.1.0",
  "publishedAt": 1775042232220
}

skill-card.md

## Description:

Image Recognition helps an agent analyze image files for OCR, object recognition, scene analysis, and screenshot understanding by sending image content and a user prompt to a configured vision model API.

This skill is ready for commercial/non-commercial use.

## Publisher:

[wangning823-arch](https://clawhub.ai/user/wangning823-arch)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and agent users use this skill to inspect local images, screenshots, documents, and other static image files, returning extracted text or natural-language visual analysis. It is especially oriented toward Android/Termux and OpenClaw environments that need Python-based image recognition without native image-processing dependencies.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: The skill uploads image content and prompts to remote model APIs.

Mitigation: Avoid sensitive screenshots, IDs, private documents, and business data unless the user accepts that external transfer.

Risk: The artifact contains an embedded shared API key fallback.

Mitigation: Remove and revoke the embedded key, then require users to configure their own key through the environment variable read by the code.

Risk: Runtime dependencies are installed from Python packages.

Mitigation: Install dependencies in an isolated environment with pinned versions before using the skill.

## Reference(s):

- [ClawHub Skill Page](https://clawhub.ai/wangning823-arch/skills/image-recognition)
- [Publisher Profile](https://clawhub.ai/user/wangning823-arch)
- [DashScope Model Studio](https://help.aliyun.com/zh/model-studio/)
- [DashScope Pricing](https://help.aliyun.com/zh/model-studio/pricing)
- [OpenRouter Chat Completions Endpoint](https://openrouter.ai/api/v1/chat/completions)
- [OpenAI-Compatible Chat Completions Endpoint](https://api.openai.com/v1/chat/completions)

## Skill Output:

**Output Type(s):** [text, markdown, code, shell commands, configuration, guidance]

**Output Format:** [Plain text or Markdown guidance, with optional shell commands, Python snippets, configuration examples, and model API responses.]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [Recognition requests use a single image path plus an optional question prompt and can return error strings for missing files, network failures, timeouts, or non-200 API responses.]

## Skill Version(s):

1.1.0 (source: server release evidence)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

usage-guide.md

# 使用指南 - Image Recognition Skill

## 场景示例

### 1. OCR 文字提取

```bash
python3 recognize.py screenshot.png "提取图片中的所有文字"
```

### 2. 识别截图内容

```bash
python3 recognize.py chat_screenshot.jpg "这是什么应用的截图?显示什么内容?"
```

### 3. 识别花朵/植物

```bash
python3 recognize.py flower.jpg "这是什么花?有什么特点?"
```

### 4. 识别文档

```bash
python3 recognize.py document.jpg "提取文档的标题和主要内容"
```

### 5. 识别二维码/条形码

```bash
python3 recognize.py qr_code.png "这是什么二维码?内容是什么?"
```

## 在 OpenClaw 会话中使用

### 示例代码

```python
import base64
import requests

def recognize_image_in_session(image_path):
    """在 OpenClaw 会话中识别图片"""
    
    # 读取图片
    with open(image_path, 'rb') as f:
        img_data = base64.b64encode(f.read()).decode()
    
    # 调用 API
    api_key = "sk-sp-e20dc070c4724e909f4b0be4d1d386e0"
    headers = {
        "Authorization": f"Bearer {api_key}",
        "Content-Type": "application/json"
    }
    
    payload = {
        "model": "qwen3.5-plus",
        "messages": [
            {
                "role": "user",
                "content": [
                    {"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{img_data}"}},
                    {"type": "text", "text": "请识别这张图片中的内容"}
                ]
            }
        ]
    }
    
    response = requests.post(
        "https://coding.dashscope.aliyuncs.com/v1/chat/completions",
        headers=headers,
        json=payload,
        timeout=90
    )
    
    if response.status_code == 200:
        result = response.json()
        return result['choices'][0]['message']['content']
    else:
        return f"Error: {response.status_code}"

# 使用
result = recognize_image_in_session("/path/to/image.jpg")
print(result)
```

## 批量处理

```bash
#!/bin/bash
# 批量识别文件夹中的所有图片

for img in /path/to/images/*.jpg; do
    echo "=== $img ==="
    python3 recognize.py "$img"
    echo ""
done
```

## 输出到文件

```bash
python3 recognize.py image.jpg > result.txt
```

## 与其他工具结合

### 配合截图工具

```bash
# 截图并识别
scrot /tmp/screenshot.png && python3 recognize.py /tmp/screenshot.png
```

### 配合文件管理器

创建桌面快捷方式或脚本,右键菜单调用。

## 性能优化

### 1. 图片压缩

```python
from PIL import Image

def compress_image(image_path, max_size=1024):
    img = Image.open(image_path)
    img.thumbnail((max_size, max_size))
    img.save(image_path, quality=85)
```

### 2. 并发处理

```python
from concurrent.futures import ThreadPoolExecutor

def batch_recognize(image_paths):
    with ThreadPoolExecutor(max_workers=5) as executor:
        results = list(executor.map(recognize_image, image_paths))
    return results
```

## 常见问题

### Q: 如何获取 API Key?

A: 访问 https://help.aliyun.com/zh/model-studio/ 注册并创建 API Key

### Q: 费用如何计算?

A: 按 token 计费,图片按分辨率折算 token。具体参考官方定价。

### Q: 支持视频吗?

A: 当前版本只支持静态图片。视频需要逐帧提取后识别。

### Q: 支持手写文字吗?

A: 支持,但准确率取决于字迹清晰度。

## 更新日志

- 2026-04-01: 初始版本

Sponsored

Ads related to Image Recognition and adjacent AI workflows.