开发者

How do I convert a photo from color to black and white using OpenGL?

开发者 https://www.devze.com 2023-01-11 20:25 出处:网络
Lets say we see an image of people watching tv in color and when I add the OpenGL code it turns into this:

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

How do I convert a photo from color to black and white using OpenGL?

What is the code to convert the phot开发者_如何转开发o from color to black and white?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消