HSV通道分解与类型转换
实现将RGB图像转换为HSV颜色空间并提取指定通道(H、S或V)的函数,包含将图像转换为uint8类型以避免OpenCV深度错误的处理逻辑。
npx skills add ECNU-ICALK/AutoSkill --skill 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.
# 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
- Prompt
- Triggers
What does the HSV通道分解与类型转换 skill do?
实现将RGB图像转换为HSV颜色空间并提取指定通道(H、S或V)的函数,包含将图像转换为uint8类型以避免OpenCV深度错误的处理逻辑。
How do I install it?
Run `npx skills add ECNU-ICALK/AutoSkill --skill 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.
