将图像从 RGB 转换为 HSV 颜色空间 [英] Converting image from RGB to HSV color space
问题描述
我在 Scipy
或 Matplotlib's
文档中找不到这样的函数(即 RGB_to_HSV()
),而且 Google 没有显示指针,除了演示 rgb2hsv
函数的 ActiveState
配方,虽然不能按原样用于 Numpy
数组.
I couldn't find such function (i.e. RGB_to_HSV()
) in Scipy
or Matplotlib's
documentations, and Google doesn't show pointers, except ActiveState
recipe which demonstrates rgb2hsv
function, though not usable on Numpy
array as is.
有人知道捷径吗?
抱歉,刚刚找到 matplotlib.colors.rgb_to_hsv()
这正是我要找的.我应该删除这个问题吗?
Sorry, just found matplotlib.colors.rgb_to_hsv()
which is exactly what I was looking for. Should I delete this question?
推荐答案
Matplotlib 提供了 RGB 到 HSV 的转换功能:matplotlib.colors.rgb_to_hsv():
Matplotlib provides RGB to HSV conversion function: matplotlib.colors.rgb_to_hsv():
matplotlib.colors.rgb_to_hsv(arr)
将 numpy 数组中的 rgb 值转换为 hsv 值输入和输出数组应具有形状 (M,N,3)
convert rgb values in a numpy array to hsv values input and output arrays should have shape (M,N,3)
这篇关于将图像从 RGB 转换为 HSV 颜色空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!