其实灰度图像就是将R,G,B分量映射到R,G,B立方体的对角线上,由此而得出的公式 gray=0.299*r+0.587*g+0.114*b 换算为整数是(9798.0*r+19238.0*g+3728.0*b)/32768.0
A = imread('123.jpg');C = 0.2989*A(:,:,1) + 0.5870*A(:,:,2) + 0.1140*A(:,:,3);imshow(C)