convert_colorspace
-
skimage.color.convert_colorspace(arr, fromspace, tospace)
[source] -
Convert an image array to a new color space.
Parameters: arr : array_like
The image to convert.
fromspace : str
The color space to convert from. Valid color space strings are
['RGB', 'HSV', 'RGB CIE', 'XYZ']
. Value may also be specified as lower case.tospace : str
The color space to convert to. Valid color space strings are
['RGB', 'HSV', 'RGB CIE', 'XYZ']
. Value may also be specified as lower case.Returns: newarr : ndarray
The converted image.
Notes
Conversion occurs through the “central” RGB color space, i.e. conversion from XYZ to HSV is implemented as
XYZ -> RGB -> HSV
instead of directly.Examples
>>> from skimage import data >>> img = data.astronaut() >>> img_hsv = convert_colorspace(img, 'RGB', 'HSV')
Please login to continue.