Converting a numpy array to grayscale

Tony Yu tsyu80 at gmail.com
Fri May 17 13:25:18 EDT 2013


On Fri, May 17, 2013 at 12:15 PM, Brickle Macho <bricklemacho at gmail.com>wrote:

> I porting a 8 line Matlab script.


<snip>

>
> So what is the difference between converting an array to gray scale verse
> reading it in as grayscale?  Have I done something wrong?  Is there another
> way to convert a numpy array to grayscale?
>
> Any help appreciated.
>
> Michael.
> --
>

Hi Michael,

They're just different color conversion factors. Based on
http://www.mathworks.com/help/images/ref/rgb2gray.html, Matlab uses:
0.2989 R + 0.5870 G + 0.1140 B

Based on the docstring for `color.rgb2gray`:
0.2125 R + 0.7154 G + 0.0721 B

Wikipedia (http://en.wikipedia.org/wiki/Grayscale) seems to suggest that
Matlab's is an older standard while the one in scikit-image is a more
recent spec.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20130517/00222c2d/attachment.html>


More information about the scikit-image mailing list