Conversion to Gray Scale May Not Be Trivial how to make a grayscale image?

Ed Trager ed.trager at gmail.com
Fri Nov 2 10:36:25 EDT 2007


Hi,

On 11/2/07, Bert Freudenberg <bert at freudenbergs.de> wrote:
> On Nov 2, 2007, at 3:16 , Albert Cahalan wrote:
>
> > Eben Eliason writes:
> >
> >> Roughly speaking, you can calculate a colored pixel's effective
> >> luminance by:
> >>
> >> Y = 0.3*R+0.59*G+0.11*B

I assume that this equation is taking into account the relative
sensitivity of the human eye to the 3 primary colors, correct?

But even if this does take into consideration the relative sensitivity
of cones in the human retina, does this equation preserve contrast
sufficiently well or not?

When we take a colored photograph of something like American Holly
(Ilex aquifolium) and convert it to grayscale, the contrast between
the red berries and the green leaves often disappears.  For example,
you can try this in Gimp and you'll see that the result is often not
very satisfying.  As far as I know, Gimp only provides one option for
converting from color to grayscale.

I believe a lot of research has been done for many years in the area
of how to convert colored images to black and white.  Software like
the Gimp ought actually to provide several methods of doing the
conversion, but to the best of my knowledge only provides one.

Having seen this topic arise on OLPC's mailing list, I am now
wondering out of curiousity to what extent OLPC has researched and
considered the possible solutions to this problem beyond the
"standard" equations?

Another thing very worth considering is the fact that nearly 8% of the
male human population world wide is red-green color blind.  Color
schemes dominated by blues and yellows work best for such individuals.
 The reason for this should be apparent from examining the attached
.png file comparing the appearance of 9 colors in (a) with how they
appear approximately to someone with red-green color deficiency in
(b).

(FYI - I work at an Eye Center where I am often reminded by the
scientists and doctors around here about such things)

Best - Ed

> >
> > To be clear on why this is rough: it performs an operation
> > on non-linear data which is only valid on linear data.
> > That is, it ignores gamma.
> >
> > From best to worst:
> >
> > a. convert to linear, Y = 0.3*R+0.59*G+0.11*B, convert back
> > b. square, Y = 0.3*R+0.59*G+0.11*B, square root
> > c. Y = 0.3*R+0.59*G+0.11*B
> > d. Y = (R+G+G+B)>>2
> > e. Y = G
> >
> > FYI, most interesting image operations are only valid on
> > linear data. This includes scaling and alpha blending.
> > Lots of programmers degrade images by screwing this up.
> > We should all try to do better, especially when the image
> > is something that might be important to the user.
>
> Right. For example, am I the only one who is bothered by the huge
> change in perceived brightness of different colors when you switch
> the DCON to grayscale mode? This switch from swizzling to the per-
> pixel brightness calculation gives a huge difference.
>
> - Bert -
>
>
> _______________________________________________
> Devel mailing list
> Devel at lists.laptop.org
> http://lists.laptop.org/listinfo/devel
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: NineColors.png
Type: image/png
Size: 1952 bytes
Desc: not available
URL: <http://lists.laptop.org/pipermail/devel/attachments/20071102/31ce9bff/attachment.png>


More information about the Devel mailing list