コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: ivlukin/seminars
        private void proccessButton_Click(object sender, RoutedEventArgs e)
        {
            resultsGrid.Visibility = System.Windows.Visibility.Visible;


            // fill all 4 images with source just for fun
            string buttonName = (sender as Button).Content.ToString();
            ImageProcessing process = new ImageProcessing();
            byte[] processedImageBytes;       
            byte[] grayscale = process.setGrayscale(originalImageBytes);

            timer.Start();
            processedImageBytes = process.blurGauss_1(grayscale, originalImage.PixelWidth, originalImage.PixelHeight, 5);
            timer.Stop();
            timeElapsed1.Content = "Time: " + timer.ElapsedMilliseconds + " ms";
            blurImage1.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);

            timer.Restart();
            processedImageBytes = process.blurGauss_2(grayscale, originalImage.PixelWidth, originalImage.PixelHeight, 5);
            timer.Stop();
            timeElapsed2.Content = "Time: " + timer.ElapsedMilliseconds + " ms";
            blurImage2.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);

            timer.Restart();
            processedImageBytes = process.blurGauss_3(grayscale, originalImage.PixelWidth, originalImage.PixelHeight, 5);
            timer.Stop();
            timeElapsed3.Content = "Time: " + timer.ElapsedMilliseconds + " ms";
            blurImage3.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);

            timer.Restart();
            processedImageBytes = process.blurGauss_4(grayscale, originalImage.PixelWidth, originalImage.PixelHeight, 5);
            timer.Stop();
            timeElapsed4.Content = "Time: " + timer.ElapsedMilliseconds + " ms";
            blurImage4.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);

        }