Пример #1
0
        static void Main(string[] args)
        {
            MatrixFilter filter = new MatrixFilter(1);
            //filter.writeKernel();

            Bitmap bitmapImage = new Bitmap("C:\\Users\\Kate\\Documents\\Visual Studio 2015\\Projects\\lab5\\lab5\\image.jpg");
            Bitmap unsafeImage = new Bitmap(bitmapImage);

            DateTime start = DateTime.Now;

            filter.applyFilterToBitmap(ref bitmapImage);
            TimeSpan elapsed = DateTime.Now - start;

            Console.WriteLine("Время работы через getPixel/setPixel = {0}", elapsed);

            start = DateTime.Now;
            filter.applyFilterToBitmapUnsafe(ref unsafeImage);
            elapsed = DateTime.Now - start;

            Console.WriteLine("Время работы через unsafe = {0}", elapsed);

            bitmapImage.Save("Bitmap.jpeg", ImageFormat.Jpeg);
            unsafeImage.Save("Unsafe.jpeg", ImageFormat.Jpeg);
            Console.ReadKey();
        }
Пример #2
0
        static void Main(string[] args)
        {
            MatrixFilter filter = new MatrixFilter(1);
            //filter.writeKernel();

            Bitmap bitmapImage = new Bitmap("image.jpg");
            Bitmap unsafeImage = new Bitmap(bitmapImage);

            DateTime start = DateTime.Now;

            filter.applyFilterToBitmap(ref bitmapImage);
            TimeSpan elapsed = DateTime.Now - start;

            Console.WriteLine("Время работы через getPixel/setPixel = {0}", elapsed);

            start = DateTime.Now;
            filter.applyFilterToBitmapUnsafe(ref unsafeImage);
            elapsed = DateTime.Now - start;

            Console.WriteLine("Время работы через unsafe = {0}", elapsed);

            bitmapImage.Save("Bitmap.jpeg", ImageFormat.Jpeg);
            unsafeImage.Save("Unsafe.jpeg", ImageFormat.Jpeg);
        }