예제 #1
0
 public Color calculatePixel(Color c)
 {
     if (GrayScale.toGrayscale(c) < _treshold)
     {
         return(Color.Black);
     }
     else
     {
         return(Color.White);
     }
 }
예제 #2
0
 private void GrayscaleButton_Click(object sender, EventArgs e)
 {
     for (int i = 0; i < pictureBox1.Image.Width; i++)
     {
         for (int j = 0; j < pictureBox1.Image.Height; j++)
         {
             Color color    = picture.Bitmap.GetPixel(i, j);
             Color newColor = Color.FromArgb(GrayScale.toGrayscale(color), GrayScale.toGrayscale(color), GrayScale.toGrayscale(color));
             picture.Bitmap.SetPixel(i, j, newColor);
         }
     }
     pictureBox1.Refresh();
 }