tags:

views:

55

answers:

1

Lets say we see an image of people watching tv in color and when I add the OpenGL code it turns into this:

http://i.dailymail.co.uk/i/pix/2008/10/18/article-1078627-02281598000005DC-210_468x382.jpg

What is the code to convert the photo from color to black and white?

+1  A: 

Temptative answer : use a glsl shader

float luminance = (in.r+in.g+in.b)/3.0;
gl_FragColor = vec4(luminance, luminance, luminance, 1.0);

but this is one lame question

Calvin1602
do you mean this ? float luma = in.r*0.3 + in.g*0.59+ in.b*0.11;
George Profenza
Technically speaking, it would be (0.35, 0.71, 0.12) for sRGB, but given the question such details are way too technical IMHO. Where does you 0.59 comes from ? NTSC RGB ?
Calvin1602
This works if you're indifferent regarding the color weights. Which one shouldn't be.
Mads Elvheim