累计概率函数的问题
Rectangle rect = new Rectangle(0, 0, curBitmap.Width, curBitmap.Height); //获得图片的矩形区域
                 System.Drawing.Imaging.BitmapData bmpData = curBitmap.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, curBitmap.PixelFormat);//以可读性的方式锁定所有图片的像素
                 IntPtr ptr = bmpData.Scan0;//取得图片的首地址
                 int bytes = curBitmap.Width * curBitmap.Height;//取得位图的像素
                 byte[] grayValues = new byte[bytes];//定义数组
                 System.Runtime.InteropServices.Marshal.Copy(ptr, grayValues, 0, bytes);//内存拷贝,将位图的像素值复制到数组里
                 byte temp;
                 int[] countPixel = new int[256];
                 int[] tempArray = new int[256];
                 //Array.Clear(tempArray, 0, 256);
                 byte[] pixelMap = new byte[256];
                 for (int i = 0; i < bytes; i++)
                 {
                     temp = grayValues[i];//取得的灰阶个数复制给temp 灰阶的个数是在0-255的数
                     countPixel[temp]++;//取得的灰阶数位下标 对像素的个数计数
                 }
                 for (int i = 0; i < 256; i++)
                 {
//我看出来了 这就是计算累计分布函数
                     if (i != 0)
                     {
                         tempArray[i] = tempArray[i - 1] + countPixel[i];  //利用tempArray数组保存灰阶数的和
                     }
                     else
                     {
                         tempArray[0] = countPixel[0];
                     }
                     //问题就是这个,前I个的概率和为什么乘以255加上0.5?这就是累计概率函数吗?
                     pixelMap[i] = (byte)(255.0 * tempArray[i] / bytes + 0.5);
                 }                  
                 for (int i = 0; i < bytes; i++)
                 {
                     temp = grayValues[i];
                     grayValues[i] = pixelMap[temp];//取得的灰阶级映射转换!
                 }
                 System.Runtime.InteropServices.Marshal.Copy(grayValues, 0, ptr, bytes);
                 curBitmap.UnlockBits(bmpData);
前I个的概率和为什么乘以255加上0.5? 累计概率函数不是前I个概率的和相加吗?
------解决方案--------------------
和相加在这里已经做了:
if (i != 0)
 {
 tempArray[i] = tempArray[i - 1] + countPixel[i]; //利用tempArray数组保存灰阶数的和
 }
乘以255加上0.5只是求出百分比, 这个255是哪来的可能要联系上下文, 或者改成100看看结果有什么不一样