rgb2grey

rgb2grey

skimage.color.rgb2grey(rgb) [source]

Compute luminance of an RGB image.

Parameters:

rgb : array_like

The image in RGB format, in a 3-D array of shape (.., .., 3), or in RGBA format with shape (.., .., 4).

Returns:

out : ndarray

The luminance image, a 2-D array.

Raises:

ValueError

If rgb2gray is not a 3-D array of shape (.., .., 3) or (.., .., 4).

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

[R49] http://www.poynton.com/PDFs/ColorFAQ.pdf

Examples

>>> from skimage.color import rgb2gray
>>> from skimage import data
>>> img = data.astronaut()
>>> img_gray = rgb2gray(img)
doc_scikit_image
2017-01-12 17:23:14
Comments
Leave a Comment

Please login to continue.