Web Page - http://www.cs.tau.ac.il/~efif/courses/Software1_Spring_03
/*! Convert colour to gray scale */ void gray_image() { int i, j, k = 0; GLubyte r, g, b, x; for (j = 0; j < image_height; j++) { for (i = 0; i < image_width; i++) { r = image[k]; g = image[k+1]; b = image[k+2]; x = (r + g + b) / 3; image[k] = x; image[k+1] = x; image[k+2] = x; k += 3; } } } |