Пример #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Reading Filter");
            MatrixFilter filter = new MatrixFilter("Gauss5.txt");

            Convolution conv = new Convolution(filter);

            Console.WriteLine("Loading image");

            //Works only with BGR24 PixelFormat
            conv.Load("cat7.bmp", true);
            Console.WriteLine("Running Unsafe... ");

            int[] counts = new int[4] {
                1, 2, 4, 8
            };
            foreach (var i in counts)
            {
                var watch = System.Diagnostics.Stopwatch.StartNew();
                conv.Run(i);
                watch.Stop();
                var elapsedMs = watch.ElapsedMilliseconds;
                Console.WriteLine("Elapsed time with " + i + " threads " + elapsedMs + "ms");
            }

            Console.WriteLine("Saving image");
            conv.Save(Directory.GetCurrentDirectory(), "UnsafeCat");
        }
Пример #2
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("Reading Filter");
            MatrixFilter filter = new MatrixFilter("Gauss5.txt");

            Convolution conv = new Convolution(filter);

            Console.WriteLine("Loading image");

            //Works only with BGR24 PixelFormat
            conv.Load("cat7.bmp", true);
            Console.WriteLine("Running Unsafe... ");
            conv.Run();
            Console.WriteLine("Saving image");
            conv.Save(Directory.GetCurrentDirectory(), "UnsafeCat");


            Console.WriteLine("Loading image");
            conv.Load("cat7.bmp");
            Console.WriteLine("Running ... ");
            conv.Run();
            Console.WriteLine("Saving image");
            conv.Save(Directory.GetCurrentDirectory(), "SafeCat");
        }