/// <summary> /// Initializes saturation/contrast/exposure/gamma/brightess filter. /// </summary> public SaturationContrastBrightnessFilter() { this.ce = new ContrastEnhancement(0, Space.YCbCr); this.sc = new SaturationCorrection(0); this.bc = new BrightnessCorrection(0, Space.YCbCr); this.ec = new ShiftCorrection(0, Space.YCbCr); this.gc = new GammaCorrection(0, Space.YCbCr); }
/// <summary> /// Contrast Enhancement algorithm. Here we create a new window from where we implement the algorithm. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void contrastEnhancement_Click(object sender, RoutedEventArgs e) { if (m_data.M_inputFilename == string.Empty || m_data.M_bitmap == null) { MessageBox.Show("Open image first!", "ArgumentsNull", MessageBoxButton.OK, MessageBoxImage.Error); return; } try { ContrastEnhancement enhancement = new ContrastEnhancement(m_data, m_vm); enhancement.Owner = this; enhancement.Show(); } catch (FileNotFoundException ex) { MessageBox.Show(ex.Message, "FileNotFoundException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "ArgumentException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (InvalidOperationException ex) { MessageBox.Show(ex.Message, "InvalidOperationException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (IndexOutOfRangeException ex) { MessageBox.Show(ex.Message, "IndexOutOfRangeException", MessageBoxButton.OK, MessageBoxImage.Error); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButton.OK, MessageBoxImage.Error); } }