Example #1
0
        private void ProcessImage()
        {
            switch (currentStep)
            {
                case 0:
                    this.Text = "GrayValue";
                    this.image = new Image(InputImage);
                    break;
                case 1:
                    this.Text = "Smoothing";
                    image.Apply(Operation.Operations.Smoothing);
                    break;
                case 2:
                    this.Text = "Edges + subtraction";
                    Image temp = new Image(image.GetPixels(), image.Size);
                    image.Apply(Operation.Operations.Edges);

                    //image = Addition.Apply(image, temp);
                    image = new Image(image.GetPixels(), image.Size);

                    image = Minval.Apply(image, temp);
                    break;
                case 3:
            <<<<<<< HEAD
                    this.Text = "Opening";
                    image.Apply(Operation.Operations.Opening);
                    break;
                case 4:
                    this.Text = "Closing";
                    image.Apply(Operation.Operations.Closing);
                    break;
                case 5:
                    this.Text = "Colouring";
                    ObjectDetection od = new ObjectDetection(image);
                    od.Apply();
                    ObjectFiltering of = new ObjectFiltering(od.objects);
                    of.Apply();
                    image = new Coloring(of.coffeeMugObjectList).ConstructNewImage(image.Size);
            =======
                    this.Text = "Negative Threshold";
                    image.Apply(Operation.Operations.NegativeThreshold);
            >>>>>>> refs/remotes/origin/Koen-Edges
                    break;
                default:
                    this.Text = "Done";
                    return;
            }

            currentStep++;
            //Display Image
            DisplayOutputImage(image);
        }
Example #2
0
        /// <summary>
        /// Image processing in steps:
        /// </summary>
        private void ProcessImage()
        {
            string text;
            switch (currentStep)
            {
                case 0:
                    text = "Image to Gray";
                    this.Text = text;
                    InputImage.Save(Image.GetFileName("Step " + (currentStep) + " - Original Image"), System.Drawing.Imaging.ImageFormat.Png);
                    image = new Image(InputImage);
                    image.Save("Step " + (currentStep + 1) + " - " + text);
                    break;
                case 1:
                    text = "Smoothing (Gaussian)";
                    this.Text = text;
                    image.Apply(Operation.Operations.Gaussian);
                    image.Apply(Operation.Operations.Gaussian);
                    image.Save("Step " + (currentStep + 1) + " - " + text);
                    break;
                case 2:
                    text = "NegativeThreshold";
                    this.Text = text;
                    image.Apply(Operation.Operations.NegativeThreshold);
                    image.Save("Step " + (currentStep + 1) + " - " + text);
                    break;
                case 3:
                    text = "Opening";
                    this.Text = text;
                    image.Apply(Operation.Operations.Opening);
                    image.Save("Step " + (currentStep + 1) + " - " + text);
                    break;
                case 4:
                    text = "Closing";
                    this.Text = text;
                    image.Apply(Operation.Operations.Closing);
                    image.Save("Step " + (currentStep + 1) + " - " + text);
                    break;
                case 5:
                    text = "Object Filtering";
                    this.Text = text;
                    ObjectDetection od = new ObjectDetection(image, true);
                    od.Apply();
                    of = new ObjectFiltering(od.objects);
                    of.Apply();
                    image = new Coloring(of.coffeeMugObjectList).ConstructNewImage(image.Size);
                    image.Save("Step " + (currentStep + 1) + " - " + text);
                    break;
                default:
                    text = "Result on Original Image";
                    this.Text = text;
                    ProcessingDone = true;
                    Bitmap result = new ShowResultOnOriginalImage(original, of.coffeeMugObjectList).ConstructNewImage();
                    image = new Image(result);//Todo: This will make this a grayscale image, so actually gotta change some things so this wont be the case. (So, save as in last step = black/white)
                    DisplayOutputImage(result);
                    result.Save(Image.GetFileName("Step " + (currentStep + 1) + " - " + text), System.Drawing.Imaging.ImageFormat.Png);
                    break;
            }

            if (text != null && text != "") this.label2.Text = text;

            currentStep++;

            return;
        }