这个C#程序哪出问题了? using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;
namespace 图片处理 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
private void button1_Click(object sender, EventArgs e) { Color c1, c2; int r, g, b; Bitmap im = new Bitmap(pictureBox1.Image); Bitmap im1 = new Bitmap(im); for (int i = 0; i < im.Width - 1; i++) for (int j = 0; j < im.Height - 1; j++) { c1 = im.GetPixel(i, j); c2 = im.GetPixel(i + 1, j + 1); r = Math.Abs(c1.R - c2.R) + 128; g = Math.Abs(c1.G - c2.G) + 128; b = Math.Abs(c1.B - c2.B) + 128; if (r < 0) r = 0; if (r > 255) r = 255; if (g < 0) g = 0; if (g > 255) g = 255; if (b < 0) b = 0; if (b > 255) b = 255; Color cc = Color.FromArgb(r, g, b); im1.SetPixel(i, j, cc); } pictureBox2.Image = im1; } } }