skimage.color.convert_colorspace(arr, ...) | Convert an image array to a new color space. |
skimage.color.gray2rgb(image) | Create an RGB representation of a grey-level image. |
skimage.color.hsv2rgb(hsv) | HSV to RGB color space conversion. |
skimage.color.lab2rgb(lab) | Lab to RGB color space conversion. |
skimage.color.lab2xyz(lab) | CIE-LAB to XYZcolor space conversion. |
skimage.color.rgb2gray(rgb) | Compute luminance of an RGB image. |
skimage.color.rgb2grey(rgb) | Compute luminance of an RGB image. |
skimage.color.rgb2hsv(rgb) | RGB to HSV color space conversion. |
skimage.color.rgb2lab(rgb) | RGB to lab color space conversion. |
skimage.color.rgb2rgbcie(rgb) | RGB to RGB CIE color space conversion. |
skimage.color.rgb2xyz(rgb) | RGB to XYZ color space conversion. |
skimage.color.rgbcie2rgb(rgbcie) | RGB CIE to RGB color space conversion. |
skimage.color.xyz2lab(xyz) | XYZ to CIE-LAB color space conversion. |
skimage.color.xyz2rgb(xyz) | XYZ to RGB color space conversion. |
Convert an image array to a new color space.
Parameters : | arr : array_like
fromspace : str
tospace : str
|
---|---|
Returns : | newarr : ndarray
|
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
>>> lena = data.lena()
>>> lena_hsv = convert_colorspace(lena, 'RGB', 'HSV')
Create an RGB representation of a grey-level image.
Parameters : | image : array_like
|
---|---|
Returns : | rgb : ndarray
|
Raises : | ValueError :
|
HSV to RGB color space conversion.
Parameters : | hsv : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
The conversion assumes an input data range of [0, 1] for all color components.
Conversion between RGB and HSV color spaces results in some loss of precision, due to integer arithmetic and rounding [R15].
References
[R15] | (1, 2) http://en.wikipedia.org/wiki/HSL_and_HSV |
Examples
>>> from skimage import data
>>> lena = data.lena()
>>> lena_hsv = rgb2hsv(lena)
>>> lena_rgb = hsv2rgb(lena_hsv)
Lab to RGB color space conversion.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
This function uses lab2xyz and xyz2rgb.
CIE-LAB to XYZcolor space conversion.
Parameters : | lab : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
Observer= 2A, Illuminant= D65 CIE XYZ tristimulus values x_ref = 95.047, y_ref = 100., z_ref = 108.883
References
[R16] | http://www.easyrgb.com/index.php?X=MATH&H=07#text7 |
[R17] | http://en.wikipedia.org/wiki/Lab_color_space |
Compute luminance of an RGB image.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
The weights used in this conversion are calibrated for contemporary CRT phosphors:
Y = 0.2125 R + 0.7154 G + 0.0721 B
If there is an alpha channel present, it is ignored.
References
[R18] | http://www.poynton.com/PDFs/ColorFAQ.pdf |
Examples
>>> from skimage.color import rgb2grey
>>> from skimage import data
>>> lena = data.lena()
>>> lena_grey = rgb2grey(lena)
Compute luminance of an RGB image.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
The weights used in this conversion are calibrated for contemporary CRT phosphors:
Y = 0.2125 R + 0.7154 G + 0.0721 B
If there is an alpha channel present, it is ignored.
References
[R19] | http://www.poynton.com/PDFs/ColorFAQ.pdf |
Examples
>>> from skimage.color import rgb2grey
>>> from skimage import data
>>> lena = data.lena()
>>> lena_grey = rgb2grey(lena)
RGB to HSV color space conversion.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
The conversion assumes an input data range of [0, 1] for all color components.
Conversion between RGB and HSV color spaces results in some loss of precision, due to integer arithmetic and rounding [R20].
References
[R20] | (1, 2) http://en.wikipedia.org/wiki/HSL_and_HSV |
Examples
>>> from skimage import color
>>> from skimage import data
>>> lena = data.lena()
>>> lena_hsv = color.rgb2hsv(lena)
RGB to lab color space conversion.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
This function uses rgb2xyz and xyz2lab.
RGB to RGB CIE color space conversion.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
References
[R21] | http://en.wikipedia.org/wiki/CIE_1931_color_space |
Examples
>>> from skimage import data
>>> from skimage.color import rgb2rgbcie
>>> lena = data.lena()
>>> lena_rgbcie = rgb2rgbcie(lena)
RGB to XYZ color space conversion.
Parameters : | rgb : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
The CIE XYZ color space is derived from the CIE RGB color space. Note however that this function converts from sRGB.
References
[R22] | http://en.wikipedia.org/wiki/CIE_1931_color_space |
Examples
>>> from skimage import data
>>> lena = data.lena()
>>> lena_xyz = rgb2xyz(lena)
RGB CIE to RGB color space conversion.
Parameters : | rgbcie : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
References
[R23] | http://en.wikipedia.org/wiki/CIE_1931_color_space |
Examples
>>> from skimage import data
>>> from skimage.color import rgb2rgbcie, rgbcie2rgb
>>> lena = data.lena()
>>> lena_rgbcie = rgb2rgbcie(lena)
>>> lena_rgb = rgbcie2rgb(lena_rgbcie)
XYZ to CIE-LAB color space conversion.
Parameters : | xyz : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
Observer= 2A, Illuminant= D65 CIE XYZ tristimulus values x_ref = 95.047, y_ref = 100., z_ref = 108.883
References
[R24] | http://www.easyrgb.com/index.php?X=MATH&H=07#text7 |
[R25] | http://en.wikipedia.org/wiki/Lab_color_space |
Examples
>>> from skimage import data
>>> from skimage.color import rgb2xyz, xyz2lab
>>> lena = data.lena()
>>> lena_xyz = rgb2xyz(lena)
>>> lena_lab = xyz2lab(lena_xyz)
XYZ to RGB color space conversion.
Parameters : | xyz : array_like
|
---|---|
Returns : | out : ndarray
|
Raises : | ValueError :
|
Notes
The CIE XYZ color space is derived from the CIE RGB color space. Note however that this function converts to sRGB.
References
[R26] | http://en.wikipedia.org/wiki/CIE_1931_color_space |
Examples
>>> from skimage import data
>>> from skimage.color import rgb2xyz, xyz2rgb
>>> lena = data.lena()
>>> lena_xyz = rgb2xyz(lena)
>>> lena_rgb = xyz2rgb(lena_xyz)