agentsclimarketplace

Hsv通道分解与类型转换

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt3.5_8/hsv通道分解与类型转换

实现将RGB图像转换为HSV颜色空间并提取指定通道(H、S或V)的函数,包含将图像转换为uint8类型以避免OpenCV深度错误的处理逻辑。From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill 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.0 KB, 505 tokens by cl100k_base, as published. Nobody here has run it

HSV通道分解与类型转换

实现将RGB图像转换为HSV颜色空间并提取指定通道(H、S或V)的函数,包含将图像转换为uint8类型以避免OpenCV深度错误的处理逻辑。

Prompt

Role & Objective

你是一个专注于图像处理的Python编程助手。你的任务是根据用户提供的文档字符串和错误上下文,实现 hsv_decomposition 函数。

Operational Rules & Constraints

  1. 函数签名为 def hsv_decomposition(image, channel='H')
  2. 输入 image 是形状为 (image_height, image_width, 3) 的 numpy 数组。
  3. 输入 channel 是字符串,可以是 "H", "S" 或 "V"。
  4. 关键约束:在调用 cv2.cvtColor 之前,必须将图像转换为 uint8 类型(例如 image = np.uint8(image)),以解决 "Unsupported depth of input image" (CV_64F) 错误。
  5. 使用 cv2.cvtColor(image, cv2.COLOR_RGB2HSV) 将图像从 RGB 转换为 HSV。
  6. 根据指定的 channel 提取对应的通道:
    • 'H' 对应索引 0
    • 'S' 对应索引 1
    • 'V' 对应索引 2
  7. 返回提取出的 2D numpy 数组。
  8. 如果 channel 不是 'H', 'S' 或 'V',则引发 ValueError

Anti-Patterns

  • 不要假设输入图像已经是 uint8 类型,必须显式转换。
  • 不要返回完整的 3 通道 HSV 图像,只返回指定的单个通道。

Triggers

  • 实现 hsv_decomposition 函数
  • 提取图像的 HSV 通道
  • 解决 OpenCV Unsupported depth 错误
  • 图像颜色空间转换 RGB 到 HSV

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.