Пример #1
0
        public CartoonEffect(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            // Fill list of filters
            List<string> filters = new List<string>();
            filters.Add("None");
            filters.Add("Gaussian (3x3)");
            filters.Add("Gaussian (5x5)");
            filters.Add("Gaussian (7x7)");
            filters.Add("Mean (3x3)");
            filters.Add("Mean (5x5)");
            filters.Add("Mean (7x7)");
            filters.Add("Median (3x3)");
            filters.Add("Median (5x5)");
            filters.Add("Median (7x7)");
            filters.Add("Median (9x9)");
            filters.Add("Low pass (3x3)");
            filters.Add("Low pass (5x5)");
            filters.Add("Sharpen (3x3)");
            filters.Add("Sharpen (5x5)");
            filters.Add("Sharpen (7x7)");
            cmbFilters.ItemsSource = filters;
            cmbFilters.SelectedIndex = 0;
        }
Пример #2
0
        /// <summary>
        /// Main Window constructor. Here we initialize the state of some menu items
        /// as well as checking the visibility of the status bar.
        /// </summary>
        public MainWindow() {
            m_data = new ImageData();
            m_vm = new ViewModel();

            InitializeComponent();
            DataContext = m_vm;

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            undo.IsEnabled = false;
            redo.IsEnabled = false;
            preferences.IsEnabled = false;

            if (statusBar.Visibility == Visibility.Visible) {
                statusBar.Visibility = Visibility.Visible;
                statusBarShowHide.IsChecked = true;
            } else {
                statusBar.Visibility = Visibility.Collapsed;
                statusBarShowHide.IsChecked = false;
            }
        }
Пример #3
0
        public static void Save(ImageFormat format, ImageData data) {
            ImageCodecInfo codec = GetEncoder(ImageFormat.Jpeg);
            Encoder quality = Encoder.Quality;
            EncoderParameters encoderArray = new EncoderParameters(1);
            EncoderParameter encoder = new EncoderParameter(quality, 85L);
            encoderArray.Param[0] = encoder;

            data.M_bitmap.Save(data.M_outputFilename, codec, encoderArray);
        }
Пример #4
0
        public OilPaintEffect(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
            cmbKernelSize.SelectedIndex = 0;
        }
Пример #5
0
        /// <summary>
        /// Contrast <c>constructor</c>
        /// Here we initialiaze the images and also we set the focus at the textBox being used.
        /// </summary>
        public Contrast(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            sldContrast.Focus();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
        }
        /// <summary>
        /// Noise Reduction (Mean filter) <c>constructor</c>.
        /// Here we initialiaze the images and also we set the default kernel.
        /// </summary>
        public NoiseReductionMean(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            three.IsChecked = true;

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
        }
        /// <summary>
        /// Salt-and-Pepper Noise generator (Black/White) <c>constructor</c>.
        /// Here we initialiaze the images and also we set the focus at the textBox being used.
        /// </summary>
        public SaltPepperNoiseBW(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            textboxNoiseBW.Focus();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;
        }
Пример #8
0
        public GradientBased(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();

            m_backgroundWorker = new BackgroundWorker();
            m_backgroundWorker.WorkerReportsProgress = false;
            m_backgroundWorker.WorkerSupportsCancellation = false;
            m_backgroundWorker.DoWork += backgroundWorker_DoWork;
            m_backgroundWorker.RunWorkerCompleted += backgroundWorker_RunWorkerCompleted;

            // Fill list of filters
            List<string> filters = new List<string>();
            filters.Add("Edge Detect Mono");
            filters.Add("Edge Detect Gradient");
            filters.Add("Sharpen");
            filters.Add("Sharpen Gradient");
            cmbFilters.ItemsSource = filters;
            cmbFilters.SelectedIndex = 0;
            rdbFirstDerivative.IsChecked = true;
        }
Пример #9
0
        /// <summary>
        /// Histogram <c>constructor</c>.
        /// Here we initialiaze the image, the data binding of the histogram diagram and the default hitogram that will be loaded.
        /// </summary>
        /// <param name="data">Input image.</param>
        public Histogram(ImageData data, ViewModel vm) {
            m_data = data;
            m_vm = vm;

            InitializeComponent();
            DataContext = m_vm;
            gray.IsChecked = true;
        }
Пример #10
0
        /// <summary>
        /// Information <c>constructor</c>.
        /// Here we calculate all the neccesary information about some aspects of the image.
        /// </summary>
        /// <param name="data"></param>
        public Information(ImageData data) {
            m_data = data;

            InitializeComponent();
            CalculateData();
        }