Пример #1
0
        private void averageDitheringButton_Click(object sender, EventArgs e)
        {
            int k = Convert.ToInt32(averageDitheringTxt.Text);
            TreshholdProvider tresh = new TreshholdProvider(k);

            tresh.calCulateTresholds(picture.Bitmap);
            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 = tresh.processPixelAverageDithering(color);
                    picture.Bitmap.SetPixel(i, j, newColor);
                }
            }
            pictureBox1.Refresh();
        }
Пример #2
0
        private void TreshholdClick(object sender, EventArgs e)
        {
            int               k = 6;
            double            t = 0.5;
            TreshholdProvider treshholdProvider = new TreshholdProvider(k, t);

            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 = treshholdProvider.processPixel(color);
                    picture.Bitmap.SetPixel(i, j, newColor);
                }
            }
            pictureBox1.Refresh();
        }