CDC::GetPixel COLORREF GetPixel( int x, int y ) const;COLORREF GetPixel( POINT point ) const;Return ValueFor either version of the function, an RGB color value for the color of the given point. It is –1 if the coordinates do not specify a point in the clipping region.ParametersxSpecifies the logical x-coordinate of the point to be examined.ySpecifies the logical y-coordinate of the point to be examined.pointSpecifies the logical x- and y-coordinates of the point to be examined.
gray=(r*0.299+g*0.587+b*0.114);得到像素的值,你先看看书吧,关于图像格式讲的很详细。最简单的差不多是bmp位图,找一本图像编程的书看看吧,很简单的。
COLORREF GetPixel( int x, int y ) const;COLORREF GetPixel( POINT point ) const;Return ValueFor either version of the function, an RGB color value for the color of the given point. It is –1 if the coordinates do not specify a point in the clipping region.ParametersxSpecifies the logical x-coordinate of the point to be examined.ySpecifies the logical y-coordinate of the point to be examined.pointSpecifies the logical x- and y-coordinates of the point to be examined.
CString ClrText;
ClrText.Format("R值为:%d\nG值为:%d\nB值为:%d",(int)GetRValue(clr),(int)GetGValue(clr),(int)GetBValue(clr));
::MessageBox(NULL,ClrText,"输出的RGB值",MB_OK);