agentsclimarketplace

Python opencv hsv颜色分类识别

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/chinese_gpt4_8/python-opencv-hsv颜色分类识别

使用Python和OpenCV库,根据给定的HSV颜色值(H:0-179, S:0-255, V:0-255)判断其对应的颜色名称(如红、绿、黑、白等)。需特别处理OpenCV的H范围以及黑色的低亮度特征。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill python-opencv-hsv颜色分类识别

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.1 KB, 635 tokens by cl100k_base, as published. Nobody here has run it

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颜色识别

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.