function y2 = rgb2gray(y)
% Usage: y2 = rgb2gray(y).  Convert rgb image (uint8 or double)
% to reasonable grayscale approximation.

y2 = 16.0 + 0.2989*double(y(:,:,1)) + 0.5870*double(y(:,:,2)) + 0.1140*double(y(:,:,3));
