Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            ownerForm.localImage = new Bitmap(ownerForm.originalImage.Width, ownerForm.originalImage.Height);
            ownerForm.updatePicturebox();
            //ownerForm.localImage = ApplyIdealReflectorMethod(ownerForm.originalImage);
            ApplyIdealReflectorMethod();
            ownerForm.updatePicturebox();

            stopwatch.Stop();
            timeLabel.Text = "Time taken " + stopwatch.ElapsedMilliseconds;
        }
Exemple #2
0
        private void setR()
        {
            UInt32 p;

            for (int i = 0; i < OwnerForm.localImage.Width; i++)
            {
                for (int j = 0; j < OwnerForm.localImage.Height; j++)
                {
                    p = ColorBalance_R((UInt32)OwnerForm.originalImage.GetPixel(i, j).ToArgb(), trackBar1.Value, trackBar1.Maximum);
                    OwnerForm.localImage.SetPixel(i, j, Color.FromArgb((int)p));
                }
            }
            OwnerForm.updatePicturebox();
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            stopwatch = new Stopwatch();
            stopwatch.Start();
            int colorLayer = determineChannel();

            Bitmap image;

            if (ownerForm != null)
            {
                image = ownerForm.originalImage;
            }
            else
            {
                image = lab2OwnerForm.originalImage;
            }

            NoizeGenerator ng     = new NoizeGenerator();
            Bitmap         result = ng.applyImpulseNoize(mode, image, trackBar1.Value, (int)numericUpDown1.Value, colorLayer);

            if (ownerForm != null)
            {
                ownerForm.localImage = new Bitmap(result);
                ownerForm.updatePicturebox();
            }
            else
            {
                lab2OwnerForm.resultImage = new Bitmap(result);
                lab2OwnerForm.updateResultBox();
            }

            stopwatch.Stop();
            timeLabel.Text = "Time taken: " + stopwatch.ElapsedMilliseconds;
        }
        private void button6_Click(object sender, EventArgs e)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            ownerForm.revertImage();
            double[] RnormalizedHystogram;
            if (DrawingR.Series[0].Points.Count > 1)
            {
                RnormalizedHystogram = generateHystogramFromDrawing(DrawingR);
            }
            else
            {
                RnormalizedHystogram = null;
            }

            double[] GnormalizedHystogram;
            if (DrawingG.Series[0].Points.Count > 1)
            {
                GnormalizedHystogram = generateHystogramFromDrawing(DrawingG);
            }
            else
            {
                GnormalizedHystogram = null;
            }

            double[] BnormalizedHystogram;
            if (DrawingB.Series[0].Points.Count > 1)
            {
                BnormalizedHystogram = generateHystogramFromDrawing(DrawingB);
            }
            else
            {
                BnormalizedHystogram = null;
            }

            int R, G, B;

            for (int i = 0; i < ownerForm.originalImage.Width; i++)
            {
                for (int j = 0; j < ownerForm.originalImage.Height; j++)
                {
                    Color color = ownerForm.originalImage.GetPixel(i, j);

                    if (RnormalizedHystogram != null)
                    {
                        R = (int)((double)RnormalizedHystogram[color.R]);
                    }
                    else
                    {
                        R = color.R;
                    }

                    if (GnormalizedHystogram != null)
                    {
                        G = (int)((double)GnormalizedHystogram[color.G]);
                    }
                    else
                    {
                        G = color.G;
                    }

                    if (BnormalizedHystogram != null)
                    {
                        B = (int)((double)BnormalizedHystogram[color.B]);
                    }
                    else
                    {
                        B = color.B;
                    }

                    ownerForm.localImage.SetPixel(i, j, Color.FromArgb(R, G, B));
                }
            }
            ownerForm.updatePicturebox();
            recalculateHystorgams();
            stopwatch.Stop();
            timeLabel.Text = "Time taken " + stopwatch.ElapsedMilliseconds;
        }