private void button8_Click(object sender, EventArgs e)
        {
            //for (int i = 0; i < 1000; i++)
            //{
            //    double x = ProcessFunctions.GaussNoise(0,1);
            //    if(Math.Abs(x)>=1)
            //        Console.WriteLine(x);
            //}
            Bitmap noiseBmp;

            ProcessFunctions.AddGaussSalt(bitmap, out noiseBmp, new GaussParam(0, 1, 32));
            pictureBox1.Image = ToolFunctions.GetThumbnail((Bitmap)noiseBmp.Clone(), pictureBox1.Height, pictureBox1.Width) as Image;
            Bitmap cleanBmp;

            ProcessFunctions.MeanFilter(noiseBmp, out cleanBmp);
            pictureBox2.Image = ToolFunctions.GetThumbnail((Bitmap)cleanBmp.Clone(), pictureBox2.Height, pictureBox2.Width) as Image;
        }
Beispiel #2
0
        private void button_Add_Gauss_Click(object sender, EventArgs e)
        {
            label_state.Text      = "Processing";
            label_state.BackColor = Color.Yellow;
            Button b = (Button)sender;

            b.Enabled = false;
            Bitmap     newBmp;
            GaussParam g = new GaussParam(((float)trackBar_Nu.Value) / 10, ((float)trackBar_Nd.Value) / 10, trackBar_Nk.Value);
            Task       t = new Task(() => {
                ProcessFunctions.AddGaussSalt(noise_oldBmp, out newBmp, g);
                this.pictureBox_WorkPlace.Image = ToolFunctions.GetThumbnail((Bitmap)newBmp.Clone(), pictureBox_WorkPlace.Height, pictureBox_WorkPlace.Width) as Image;
                noise_oldBmp = newBmp;
            });

            t.Start();
            t.Wait();

            b.Enabled             = true;
            label_state.Text      = "Finish";
            label_state.BackColor = Color.Green;
        }