C# 中遍历图片中的像素,发代码给我(图片中只有黑白2种颜色) 20
展开全部
Bitmap myBit1;
private void openPicOne_Click(object sender, EventArgs e)
{//打开一张图的button
myBit1 = null;
OpenFileDialog myDLG1 = new OpenFileDialog();
if (myDLG1.ShowDialog() == DialogResult.OK)
myBit1 = new Bitmap(myDLG1.FileName);
}
private void travel_Click(object sender, EventArgs e)
{//遍历所有像素的button
for (int i = 0; i < myBit1.Width; i++)
{
for (int j = 0; j < myBit1.Height; j++)
{
myBit1.GetPixel(i, j);
//这个是获取,具体如何使用就你自己弄了。
}
}
}
private void openPicOne_Click(object sender, EventArgs e)
{//打开一张图的button
myBit1 = null;
OpenFileDialog myDLG1 = new OpenFileDialog();
if (myDLG1.ShowDialog() == DialogResult.OK)
myBit1 = new Bitmap(myDLG1.FileName);
}
private void travel_Click(object sender, EventArgs e)
{//遍历所有像素的button
for (int i = 0; i < myBit1.Width; i++)
{
for (int j = 0; j < myBit1.Height; j++)
{
myBit1.GetPixel(i, j);
//这个是获取,具体如何使用就你自己弄了。
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询