关于图像处理的方法(内存法)
if(curBitmap !=null)
             {
                 Rectangle rect = new Rectangle(0,0,curBitmap.Width,curBitmap.Height);
                 BitmapData bmpdata = curBitmap.LockBits(rect, ImageLockMode.ReadWrite,curBitmap.PixelFormat);
                 IntPtr ptr = bmpdata.Scan0;
                 int bytes = curBitmap.Width * curBitmap.Height * 3;
                 byte [] rgbValues=new byte [bytes];
                 System.Runtime.InteropServices.Marshal.Copy(ptr, rgbValues, 0, bytes);
                 double colorTemp = 0;
                 for (int i = 0; i < rgbValues.Length;i=i+3 )
                 {
                     colorTemp = rgbValues[i + 2] * 0.299 + rgbValues[i + 1] * 0.587 + rgbValues[i] * 0.114;//为什么不是是rgbvalues[i]*0.299+rgbvalues[i+1]*0.587+rgbvalues[i+2]*0.114
                     rgbValues[i] = rgbValues[i + 1] = rgbValues[i + 2] = (byte)colorTemp;
                 }
                 System.Runtime.InteropServices.Marshal.Copy(rgbValues, 0, ptr, bytes);
                 curBitmap.UnlockBits(bmpdata);
                 Invalidate();
             }
------解决方案--------------------像素在内存里是B、G、R顺序保存的。。
------解决方案--------------------