不知道以下代码是否对你有帮助:
Bitmap hehe = new Bitmap(this.pictureBoxButtomLeft.Image,this.pictureBoxButtomLeft.Image.Width,this.pictureBoxButtomLeft.Image.Height);
System.Drawing.Color temp = hehe.GetPixel(i,j);for(int i = 0;i<this.pictureBoxButtomLeft.Image.Width;i++)
{
for(int j=0;j<this.pictureBoxButtomLeft.Image.Height;j++)
{
System.Drawing.Color temp = hehe.GetPixel(i,j); int avg = (Convert.ToInt32(temp.G)+Convert.ToInt32(temp.B)+Convert.ToInt32(temp.R))/3;
byte temp11 = Convert.ToByte(avg);
System.Drawing.Color tempcolor = System.Drawing.Color.FromArgb(temp11,temp11,temp11);
hehe.SetPixel(i,j,yh);
}
}
this.pictureBoxButtomMiddle.Image = hehe;是将一个图片的RGB取出,取平均值的
Bitmap hehe = new Bitmap(this.pictureBoxButtomLeft.Image,this.pictureBoxButtomLeft.Image.Width,this.pictureBoxButtomLeft.Image.Height);
System.Drawing.Color temp = hehe.GetPixel(i,j);for(int i = 0;i<this.pictureBoxButtomLeft.Image.Width;i++)
{
for(int j=0;j<this.pictureBoxButtomLeft.Image.Height;j++)
{
System.Drawing.Color temp = hehe.GetPixel(i,j); int avg = (Convert.ToInt32(temp.G)+Convert.ToInt32(temp.B)+Convert.ToInt32(temp.R))/3;
byte temp11 = Convert.ToByte(avg);
System.Drawing.Color tempcolor = System.Drawing.Color.FromArgb(temp11,temp11,temp11);
hehe.SetPixel(i,j,yh);
}
}
this.pictureBoxButtomMiddle.Image = hehe;是将一个图片的RGB取出,取平均值的
同意
System.Drawing.Color color2 = System.Drawing.Color.FromArgb(红,绿,蓝)
注意,不是通过new得到的。