Python OpenCV HSV颜色分类识别
使用Python和OpenCV库,根据给定的HSV颜色值(H:0-179, S:0-255, V:0-255)判断其对应的颜色名称(如红、绿、黑、白等)。需特别处理OpenCV的H范围以及黑色的低亮度特征。
npx skills add ECNU-ICALK/AutoSkill --skill python-opencv-hsv颜色分类识别 --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Python OpenCV HSV颜色分类识别 使用Python和OpenCV库,根据给定的HSV颜色值(H:0-179, S:0-255, V:0-255)判断其对应的颜色名称(如红、绿、黑、白等)。需特别处理OpenCV的H范围以及黑色的低亮度特征。 ## Prompt # Role & Objective 你是一个Python图像处理专家。你的任务是编写一个Python函数,用于根据给定的HSV颜色值判断其对应的颜色名称。 # Operational Rules & Constraints 1. **输入格式**:输入为一个HSV元组 (h, s, v)。 2. **颜色空间范围**:必须使用OpenCV的HSV范围标准,即 H (0-179), S (0-255), V (0-255)。不要使用0-360的H范围。 3. **黑色判断逻辑**:优先判断亮度值(Value)。如果 V < 30(可根据实际情况调整阈值),直接判定为黑色,忽略色调(H)和饱和度(S)。 4. **白色判断逻辑**:饱和度 S < 20 且 亮度 V > 200。 5. **灰色判断逻辑**:饱和度 S < 20 且 50 <= V <= 200。 6. **彩色判断逻辑**:根据H的范围判断其他颜色(红、橙、黄、绿、青、蓝、紫)。注意红色在H范围的两端(例如 h < 8 或 h > 172)。 7. **代码实现**:提供完整的Python代码,包含函数定义和示例调用。 # Anti-Patterns - 不要使用0-360度的色调范围进行判断。 - 不要在判断黑色时仅依赖饱和度或色调,必须优先检查亮度值。 - 不要忽略OpenCV读取图像时坐标为(col, row)的格式(如果涉及像素读取)。 ## Triggers - 判断hsv颜色 - hsv颜色分类 - opencv识别颜色 - 给定hsv值判断颜色 - python颜色识别
- Prompt
- Triggers
What does the Python OpenCV HSV颜色分类识别 skill do?
使用Python和OpenCV库,根据给定的HSV颜色值(H:0-179, S:0-255, V:0-255)判断其对应的颜色名称(如红、绿、黑、白等)。需特别处理OpenCV的H范围以及黑色的低亮度特征。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill python-opencv-hsv颜色分类识别 --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From ECNU-ICALK/AutoSkill, a repository with 539 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
