コード例 #1
0
        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));
            }
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }
コード例 #5
0
        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));
        }
コード例 #6
0
        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));
            }
        }
コード例 #7
0
        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));
        }
コード例 #8
0
        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));
            }
        }
コード例 #9
0
        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));
        }