Esempio n. 1
0
        /// <summary>
        /// Uruchomienie filtrowania sekwencyjnego
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnFilterSeq_Click(object sender, RoutedEventArgs e)
        {
            var swSeq      = new Stopwatch();
            int filterSize = Convert.ToInt32(SizeMatrix.Text);

            try
            {
                //Utworzenie macierzy pikseli
                var imageMatrix = _imageConvert.GetPixelArray(_inputImage.UriSource.LocalPath);

                _medianaFilter = new MedianaFilter(imageMatrix);

                //Odfiltrowanie obrazu
                swSeq.Start();
                var filteredArrayImage = _medianaFilter.SequenceFiltration(filterSize);
                swSeq.Stop();

                //Utworzenie obrazu z macierzy pikseli
                var filteredImage = _imageConvert.ArrayToBitmapImage(filteredArrayImage);

                ImgFilter.Source = filteredImage;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Błąd", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            OneThredCount   = (int)swSeq.ElapsedMilliseconds;
            TimeSeq.Content = "Czas filtrowania sekwencyjnego " + OneThredCount + "ms";
            ProgresCheck();
        }