I have a problem. I want to represent an image into 1 and 0 number in matrix. This is my code:
private void button3_Click(object sender, EventArgs e)
{
Color originalColor;
int grayScale;
File2 = new Bitmap(File);
for (int i = 0; i < File2.Height; i++)
{
for (int j = 0; j < File2.Width; j++)
{
textBox1.Text = "a";
originalColor = File2.GetPixel(i, j);
grayScale = (int)((originalColor.R) + (originalColor.G) + (originalColor.B)) / 3;
if (grayScale > 127)
{
textBox1.Text += "1 ";
}
else
{
textBox1.Text += "0 ";
}
}
textBox1.Text += "\n";
}
}
The textbox doesn't show anything after I click the button3. Can someone explain what's wrong with that code?
EDIT: it works. thanks MajkeloDev