← 返回 Skills 市场
johnsonxuan

Pill Counter Skill

作者 johnsonxuan · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
29
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install pill-counter-skill
功能描述
使用 OpenCV 图像识别精确计数药片。自动检测、分类(小圆/中圆/大圆/椭圆)、 标注结果图片。支持 JSON 和文本两种输出格式。 适用场景:药品盘点、处方核对、药物研究计数。
使用说明 (SKILL.md)

💊 药片精确计数 Skill

自动识别图片中的药片,按形状和大小分类计数。

功能

  • ✅ 自动检测图片中的所有药片
  • ✅ 分类:小圆形、中圆形、大圆形、椭圆形
  • ✅ 逐个编号标注,生成结果图片
  • ✅ 支持 JSON / 文本两种输出格式
  • ✅ 处理粘连药片(分水岭算法)

使用方法

基本用法

python3 scripts/pill_counter.py \x3C图片路径>

指定输出格式

python3 scripts/pill_counter.py image.jpg --output json

保存标注结果图

python3 scripts/pill_counter.py image.jpg --save result.jpg

完整参数

python3 scripts/pill_counter.py image.jpg --output text --save result.jpg

输出示例

文本输出(默认)

=============================================
  📊 药片计数结果
=============================================
  ✅ 检测总数: 240 粒

  🟢 小圆形: 13 粒
  🔵 中圆形: 204 粒
  🟠 椭圆形: 23 粒

  🟢=小圆  🔵=中圆  🟣=大圆  🟠=椭圆
=============================================

JSON 输出

{
  "total": 240,
  "image_size": [3072, 4096],
  "categories": {
    "小圆形": 13,
    "中圆形": 204,
    "椭圆形": 23
  }
}

分类说明

类型 识别规则 颜色标记
小圆形 圆形度>0.75,面积\x3C中位数70% 🟢 绿色
中圆形 圆形度>0.75,面积在中位数±40% 🔵 青色
大圆形 圆形度>0.75,面积>中位数140% 🟣 紫色
椭圆形 宽高比>1.4 或 \x3C0.7 🟠 橙色

依赖

  • Python 3.6+
  • opencv-python-headless
  • numpy

注意事项

  • 图片需要清晰,药片与背景有明显对比度
  • 白色药片在深色背景上效果最佳
  • 药片有粘连时会自动分离,极端重叠可能影响精度
  • 碎片可能被误识别为小药片
安全使用建议
Install the Python dependencies in a virtual environment, run the tool on copies of pill images, specify an explicit --save path in a workspace folder, and manually verify results before using them for inventory, prescription, or safety-critical decisions.
功能分析
Type: OpenClaw Skill Name: pill-counter-skill Version: 1.0.0 The skill is a legitimate image processing tool for counting and classifying pills using OpenCV. The Python script (scripts/pill_counter.py) performs standard computer vision operations like thresholding and contour detection without any suspicious behaviors such as network requests, shell execution, or unauthorized file access. Permissions are properly restricted to a specific workspace directory.
能力评估
Purpose & Capability
The code and documentation coherently match a local OpenCV pill-counting purpose, with no network or credential behavior shown. Because it is framed for medication and prescription workflows, the counts should be treated as an aid rather than a sole source of truth.
Instruction Scope
The skill is user-invoked through a Python command and its examples are direct CLI usage. The script does, however, create an annotated result image by default even when the user does not provide --save.
Install Mechanism
There is no automatic install spec, but SKILL.md asks the user to install unpinned Python packages with pip; this is expected for OpenCV processing but should be done in a controlled environment.
Credentials
Local image reads and result-image writes are proportional to the stated purpose. The declared write permission is scoped to a workspace path, while the script can write to a user-supplied --save path or next to the input image.
Persistence & Privilege
No credentials, account access, background workers, persistent memory, or autonomous persistence are shown; the only persistent artifact is a local output image.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install pill-counter-skill
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /pill-counter-skill 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
pill-counter-skill 1.0.0 - 首次发布,支持使用 OpenCV 自动检测图片中的药片并分类计数 - 按小圆形、中圆形、大圆形、椭圆形进行分类 - 结果可输出为文本或 JSON,同时可生成带编号标注的图片 - 支持处理粘连药片(分水岭算法) - 提供命令行界面支持多种参数和输出方式
元数据
Slug pill-counter-skill
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Pill Counter Skill 是什么?

使用 OpenCV 图像识别精确计数药片。自动检测、分类(小圆/中圆/大圆/椭圆)、 标注结果图片。支持 JSON 和文本两种输出格式。 适用场景:药品盘点、处方核对、药物研究计数。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 29 次。

如何安装 Pill Counter Skill?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install pill-counter-skill」即可一键安装,无需额外配置。

Pill Counter Skill 是免费的吗?

是的,Pill Counter Skill 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Pill Counter Skill 支持哪些平台?

Pill Counter Skill 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Pill Counter Skill?

由 johnsonxuan(@johnsonxuan)开发并维护,当前版本 v1.0.0。

💬 留言讨论