private void button2_Click(object sender, EventArgs e) { BinImage bi = new BinImage(matr, im.Width, im.Height); bi.LoadMask(createCircleMatr(10)); bi.Dilation(); DrawMatrix(bi); MessageBox.Show("Dilation Done"); bi.Erosion(); DrawMatrix(bi); }
private void DrawMatrix(BinImage bi) { // pictureBox1.Dispose(); btp = new Bitmap(bi.Width, bi.Height); for (int i = 0; i < bi.Width; ++i) for (int j = 0; j < bi.Height; ++j) if (bi.matr[i, j] == 1) btp.SetPixel(i, j, Color.White); else btp.SetPixel(i, j, Color.Black); pictureBox1.Image = btp; pictureBox1.Invalidate(); pictureBox1.Update(); }