public override void MessageReceived(IEBCMessage ebcMessage)
        {
            this.EBCMessageData = new EBCMessageData(ebcMessage.EBCMessageData);
            this.EBCMessageData.ImageType = ImageTypes.Minuend;

            IEBCMessageData newEBCMessageData = new EBCMessageData(ebcMessage.EBCMessageData);
            newEBCMessageData.ImageType = ImageTypes.Subtrahend;

            this.Erodation.In_ReceiveMessage(new EBCMessage(newEBCMessageData));
        }
        private void OperationFinished(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.IncreaseContrast,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        void BotteExtractionComplete(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.BottleCheck,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        private void OpeningFinished(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Closing,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        private void Subtraction_Out_SendMessage(IEBCMessage ebcMessage)
        {
            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.GradientIn,
                ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

            // Send the debug data with the resulting image containing the ellipse.
            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] lookUpTable = lastEBCMessageData.Data as int[];
            Bitmap resultingImage = Histograms.CreateHistogramEqualizedImage(lookUpTable, lastEBCMessageData.Image);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.HistogramEqualiziation, resultingImage, lastEBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] cumulativeHistogram = lastEBCMessageData.Data as int[];
            int[] lookUpTable = LookUpTables.CreateLookUpTable(cumulativeHistogram);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.LookUpTable,
                lastEBCMessageData.Image, lookUpTable);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image, lookUpTable);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] grayValueHistogram = Histograms.CreateGrayValueHistogram(lastEBCMessageData.Image);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.GrayValueHistogram,
                lastEBCMessageData.Image, grayValueHistogram);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image, grayValueHistogram);
            debugData.AddSourceImage(lastEBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            int[] grayValueHistogram = lastEBCMessageData.Data as int[];
            int[] cumulativeHistogram = Histograms.CreateCumulativeHistogram(grayValueHistogram);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.CumulativeHistogram,
                lastEBCMessageData.Image, cumulativeHistogram);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, lastEBCMessageData.Image, cumulativeHistogram);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        private void ProcessScan()
        {
            if (this.EBCMessageData != null && this.LineScanCoordinatesMessage != null)
            {
                int[] lineScanData = ImageScans.LineScan(this.EBCMessageData.Image, this.LineScanCoordinatesMessage.Coordinates);

                IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.LineScan,
                    this.EBCMessageData.Image, lineScanData);

                IDebugData debugData = new DebugData(ebcMessageData.DataResultType, this.EBCMessageData.Image, lineScanData);

                this.OnOut_ShapeDebugMessage(debugData);

                this.OnOut_SendResult(new EBCMessage(ebcMessageData));
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            int[,] matrix = new int[,] { { 1, 1, 1 }, { 1, -8, 1 }, { 1, 1, 1 } };

            Bitmap resultingImage = RankingOperations.ApplyLaplace(ebcMessage.EBCMessageData.Image, matrix);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Laplace,
                resultingImage, ebcMessage.EBCMessageData.ImageType);

            // Send the debug data with the resulting image containing the ellipse.
            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        private void AddImages()
        {
            if (this.FirstSummand != null && this.SecondSummand != null)
            {
                Bitmap resultingImage = Arithmetics.SumImages(this.FirstSummand, this.SecondSummand);

                IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Addition, resultingImage);

                IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
                debugData.AddSourceImage(this.FirstSummand);
                debugData.AddSourceImage(this.SecondSummand);

                this.OnOut_ShapeDebugMessage(debugData);

                this.OnOut_SendResult(new EBCMessage(ebcMessageData));
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            for (int i = 0; i < this.RepeatCount; i++)
            {
                // The real data. Both images are equal!
                IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.ImageRepeater,
                    ebcMessage.EBCMessageData.Image, ebcMessage.EBCMessageData.ImageType);

                // Send the debug data with the resulting image containing the ellipse.
                IDebugData debugData = new DebugData(ebcMessageData.DataResultType, ebcMessage.EBCMessageData.Image);
                debugData.AddSourceImage(ebcMessage.EBCMessageData.Image);

                this.OnOut_ShapeDebugMessage(debugData);

                this.OnOut_SendResult(new EBCMessage(ebcMessageData));
            }
        }
        private void SubstractImages()
        {
            if (this.SubtrahendImage != null && this.MinuendImage != null)
            {
                Bitmap resultingImage = Arithmetics.SubtractImages(this.MinuendImage, this.SubtrahendImage);

                IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Subtraction, resultingImage);

                IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
                debugData.AddSourceImage(this.MinuendImage);
                debugData.AddSourceImage(this.SubtrahendImage);

                this.OnOut_ShapeDebugMessage(debugData);

                this.OnOut_SendResult(new EBCMessage(ebcMessageData));
            }
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            IEBCMessageData lastEBCMessageData = ebcMessage.EBCMessageData;

            Bitmap resultingImage = FloodFills.FloodFill(lastEBCMessageData.Image, FloodFillModes.FourNeighbour, 
                new Point(150, 250), 0, 255);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.FloodFill,
                resultingImage, lastEBCMessageData.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(lastEBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        public override void MessageReceived(IEBCMessage ebcMessage)
        {
            Bitmap sourceImage = ebcMessage.EBCMessageData.Image;

            Point center = new Point(sourceImage.Width / 2, sourceImage.Height / 2);
            int height = sourceImage.Height - center.Y;

            Bitmap resultingImage = RegionOfInterests.CreateROI(sourceImage, 0, 0, sourceImage.Width, height);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.ROICenter, resultingImage, this.ImageType);

            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(ebcMessage.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }
        private void ProcessScan()
        {
            if (this.EBCMessageData != null && this.EllipseScanCoordinatesMessage != null)
            {
                Bitmap resultingImage = new Bitmap(this.EBCMessageData.Image);

                int[] ellipseScanData = ImageScans.EllipseScan(resultingImage, this.EllipseScanCoordinatesMessage.EllipseCenter,
                    this.EllipseScanCoordinatesMessage.EllipseWidth, this.EllipseScanCoordinatesMessage.EllipseHeight);

                // The real data. Both images are equal!
                IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.EllipseScan,
                    this.EBCMessageData.Image, ellipseScanData);

                // Send the debug data with the resulting image containing the ellipse.
                IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage, ellipseScanData);
                debugData.AddSourceImage(this.EBCMessageData.Image);

                this.OnOut_ShapeDebugMessage(debugData);

                this.OnOut_SendResult(new EBCMessage(ebcMessageData));
            }
        }
        private void ApplyThresholds()
        {
            int[,] thresholds = new int[this.ThresholdData.Count, 3];

            for (int i = 0; i < this.ThresholdData.Count; i++)
            {
                thresholds[i, 0] = this.ThresholdData[i].Min;
                thresholds[i, 1] = this.ThresholdData[i].Max;
                thresholds[i, 2] = this.ThresholdData[i].GrayValue;
            }

            Bitmap resultingImage = Thresholds.ApplyThresholds(this.EBCMessageData.Image, thresholds);

            IEBCMessageData ebcMessageData = new EBCMessageData(DataResultTypes.Threshold,
                resultingImage, this.EBCMessageData.ImageType);

            // Send the debug data with the resulting image containing the ellipse.
            IDebugData debugData = new DebugData(ebcMessageData.DataResultType, resultingImage);
            debugData.AddSourceImage(this.EBCMessageData.Image);

            this.OnOut_ShapeDebugMessage(debugData);

            this.OnOut_SendResult(new EBCMessage(ebcMessageData));
        }