Wednesday, March 9, 2011

Convert Color Images to Gray Images Using Programming

How to convert Color Images to Gray Images

There are some techniques to do this, and below is the one of them:

To convert color image to gray image convert all pixels like this pseudo code:


PIXEL clr;
COLOR old,new;

FOR ALL clr in image DO
BEGIN
old = clr.color;
new.red = 0.5 * old.red + 0.3 * old.green + 0.2 * old.blue;
new.green = 0.5 * old.red + 0.3 * old.green + 0.2 * old.blue;
new.blue = 0.5 * old.red + 0.3 * old.green + 0.2 * old.blue;
clr.color = new;
END

No comments:

Post a Comment