示例#1
0
        public static void ChamferFromLeft(string filepath)
        {
            logger.Trace("Starting Chamfer From Left");
            double[] kernel = new[] { -1.0, 0.0, 1.0 };
            Bitmap   source = new Bitmap(filepath);
            var      image  = new Image <Bgra, Byte>(source);

            double[] lumas       = Luminousity.RepresentativeLuminousity(image, 2, 4, Direction.FromLeft);
            int[]    indicies    = Utility.GetKernelIndicies(kernel, -1);
            var      convolution = Utility.Convolute(lumas, kernel, indicies);
            var      processed   = Utility.Threshold(Utility.Absolute(convolution), 0.3);
            var      chamfers    = Chamfer.Measure(processed);

            Visualizer.Plot(chamfers, "Convolution Result");
        }
示例#2
0
        public static void ConvolutionFromLeft(string filepath)
        {
            logger.Trace("Starting Convolution From Left");
            double[] kernel = new[] { -1.0, 0.0, 1.0 };
            Bitmap   source = new Bitmap(filepath);
            var      image  = new Image <Bgra, Byte>(source);

            double[] lumas       = Luminousity.RepresentativeLuminousity(image, 1, 4, Direction.FromRight);
            int[]    indicies    = Utility.GetKernelIndicies(kernel, -1);
            var      convolution = Utility.Convolute(lumas, kernel, indicies);
            var      result      = Utility.Absolute(convolution);
            var      processed   = Utility.Threshold(Utility.Absolute(convolution), 0.3);

            for (int ii = 0; ii < result.Length; ii++)
            {
                if (processed[ii] != 0.0)
                {
                    result[ii] = processed[ii];
                }
            }
            Visualizer.Plot(result, "Convolution");
        }