Exemplo n.º 1
0
        public void SobelTest()
        {
            var           image         = Util.GetGreyScaleImage(@"D:\Image Resource\7.png");
            GaussianBlur  gaussianBlur  = new GaussianBlur(image);
            SobelOperator sobelOperator = new SobelOperator(gaussianBlur.GaussianBlurredImage);

            VectorPixel.NormalizeIntensity(sobelOperator.VectorPixels);
            Util.SaveImage(@"D:\Sobel.png", VectorPixel.GetByteArray(sobelOperator.VectorPixels));
            CannyEdgeFilter cannyEdgeFilter = new CannyEdgeFilter(sobelOperator.VectorPixels, 20, 50);

            Util.SaveImage(@"D:\Canny.png", VectorPixel.GetByteArray(cannyEdgeFilter.VectorPixels));
            Process.Start(@"D:\Canny.png");
        }
Exemplo n.º 2
0
        private void ApplyCannyEdgeFilter()
        {
            CannyEdgeFilter cannyEdgeFilter = new CannyEdgeFilter(_vectorPixels, LowerThreshold, UpperThreshold);
            string          imgLoc;

            if (!string.IsNullOrEmpty(Image) && Image.Equals(@"D:\Sobel1.png"))
            {
                imgLoc = @"D:\Sobel2.png";
            }
            else
            {
                imgLoc = @"D:\Sobel1.png";
            }
            Util.SaveImage(imgLoc, VectorPixel.GetByteArray(cannyEdgeFilter.VectorPixels));
            Image = imgLoc;
        }