Пример #1
0
 private void Brightness_Click(object sender, EventArgs e)
 {
     tmp = img.Clone();
     tmp = ImageOperation.Brightness(tmp, Convert.ToInt32(BrightnessSlider.Value));
     pictureBox2.Image = tmp.bitmap;
     generateHistogram(img, chart1);
     generateHistogram(tmp, chart2);
 }
Пример #2
0
 private void Slider_Scroll(object sender, EventArgs e)
 {
     if (Op == Operations.Contrast)
     {
         After = ImageOperation.Contrast(Before, Slider.Value);
     }
     else if (Op == Operations.Brighthness)
     {
         After = ImageOperation.Brightness(Before, Slider.Value);
     }
     this.AfterPictureBox.Image = After.bitmap;
 }
Пример #3
0
        private void ApplyButton_Click(object sender, EventArgs e)
        {
            if (this.Text == "Contrast")
            {
                form.img = ImageOperation.Contrast(form.img, Slider.Value);
            }
            else
            {
                form.img = ImageOperation.Brightness(form.img, Slider.Value);
            }

            PictureBox pic = form.Controls["MDIPicture"] as PictureBox;

            pic.Image = form.img.bitmap;
            this.Close();
        }
Пример #4
0
        private void PreviewButton_Click(object sender, EventArgs e)
        {
            if (Op == Operations.Contrast)
            {
                form.img = ImageOperation.Contrast(form.img, Slider.Value);
            }
            else if (Op == Operations.Brighthness)
            {
                form.img = ImageOperation.Brightness(form.img, Slider.Value);
            }
            else if (Op == Operations.MeanFilter)
            {
                int width   = int.Parse(MaskWidthTextBox.Text);
                int height  = int.Parse(MaskHeightTextBox.Text);
                int originx = int.Parse(OriginXTextbox.Text);
                int originy = int.Parse(OriginYTextBox.Text);

                if (RadioButton1D.Checked == true)
                {
                    double[] values = new double[width];
                    for (int i = 0; i < width; ++i)
                    {
                        values[i] = (double)1 / width;
                    }
                    form.img = ImageOperation.LinearFilter1d(form.img, values, originx, originy, ImageOperation.PostProcessing.NO);
                }
                else if (RadioButton2D.Checked == true)
                {
                    //add 2d filter here
                }
            }
            PictureBox pic = form.Controls["MDIPicture"] as PictureBox;

            pic.Image = form.img.bitmap;
            this.Close();
        }