unsigned long mm=0;
for(unsigned long i=0;i<m_Height * m_Width;i+=1)
{
int r,g,b;
BYTE target;
WORD source=*(VideoBuffer+i);
r=(source&0xf800)>>11;
g=(source&0x07e0)>>5;
b=source&0x001f;
target = ceil(0.30 * r + 0.59 * g + 0.11 * b);
mm += 1;
*(BmpBuffer + mm) = target;//RGB(target,target,target);
}
以上是我写的将一副16位的彩色图象(565)转化为8位灰度图象的程序,转化出来就是太暗了,不知道是什么原因,请高手指教!