本文共 818 字,大约阅读时间需要 2 分钟。
////// Mean value computing. /// /// The source image. ///public static double GetMeanProcess(WriteableBitmap src) 32 图像均值计算 { if (src != null) { double mean = 0.0; int sum = 0; int gray = 0,number=0; byte[] temp = src.PixelBuffer.ToArray(); for (int i = 0; i < temp.Length; i += 4) { gray = (int)(temp[i] * 0.114 + temp[i + 1] * 0.587 + temp[i + 2] * 0.299); sum += gray; number++; } mean =(double)(sum/number); return mean; } else { return 0; } }