Exemple #1
0
        public Bitmap GetFilteredImage(Bitmap bitmap)
        {
            var bytes = FilterHelper.BitmapToArray(bitmap);
            //  var filterMatrix = new double[,]
            //{ { -1,  0,  1, },
            //        { -2,  0,  2, },
            //        { -1,  0,  1, }, };
            var filterMatrix = new double[, ]
            {
                { 0, -2, 0 },
                { -2, 11, -2 },
                { 0, -2, 0 }
            };
            //var filterMatrix = new double[,]
            //{
            //    {0, 0, 0, 0, 0},
            //    {0, 0, -1, 0, 0},
            //    {0, -1, 5, -1, 0},
            //    {0, 0, -1, 0, 0},
            //    {0, 0, 0, 0, 0}
            //};

            var result = _convolution.Filter(bytes, filterMatrix);

            return(FilterHelper.ArrayToBitmap(result));
        }
Exemple #2
0
        public void ProcessImage(IImage image)
        {
            var filterMatrix = new double[, ]
            {
                { -1, -1, -1, -1, -1, },
                { -1, -1, -1, -1, -1, },
                { -1, -1, 24, -1, -1, },
                { -1, -1, -1, -1, -1, },
                { -1, -1, -1, -1, -1 },
            };

            _convolutionFilter.Filter(image, filterMatrix);
        }