//偏差指数评价 private void button2_Click(object sender, EventArgs e) { double Br, Bg, Bb;//三通道偏差指数 double r, g, b; r = g = b = 0; Bitmap map2 = (Bitmap)img2; for (int i = 0; i < newBitmap.Width; i++) { for (int j = 0; j < newBitmap.Height; j++) { Color pixel1 = newBitmap.GetPixel(i, j); Color piexl2 = map2.GetPixel(i, j); r += Math.Abs(pixel1.R - piexl2.R) * 1.0 / piexl2.R; g += Math.Abs(pixel1.G - piexl2.G) * 1.0 / piexl2.G; b += Math.Abs(pixel1.B - piexl2.B) * 1.0 / piexl2.B; } } Br = r / (newBitmap.Width * newBitmap.Height); Bg = g / (newBitmap.Width * newBitmap.Height); Bb = b / (newBitmap.Width * newBitmap.Height); MessageBox.Show("融合图三通道偏差指数" + "\r\n" + "Br:" + Br.ToString() + " " + "Bg:" + Bg.ToString() + " " + "Bb:" + Bb.ToString()); }