public void Sobel(object parameter)
        {
            if (m_isColorImage == true)
            {
                System.Windows.MessageBox.Show("Please load an grayscale image for this filter!");
            }

            if (m_grayImage != null)
            {
                DialogBox dialogBox = new DialogBox();
                int       param     = -1;
                if (dialogBox.ShowDialog() == true)
                {
                    param = Int32.Parse(dialogBox.ResponseText);
                }
                if (param >= 0)
                {
                    m_grayProcessedImage = Hough.Sobel(m_grayImage, param);
                    ProcessedImage       = ImageConverter.Convert(m_grayProcessedImage);
                    OnPropertyChanged("ProcessedImage");
                    WriteIntoFile("Sobel filter with threshold " + param.ToString() + " .");
                }
                else
                {
                    System.Windows.MessageBox.Show("Threshold must be between 0 and 255.");
                }
            }
        }
        public void SaveAsOriginal(object parameter)
        {
            switch (m_isColorImage)
            {
            case true:
            {
                if (m_colorProcessedImage == null && m_grayProcessedImage == null)
                {
                    System.Windows.MessageBox.Show("Doesn't exist processed image.");
                    return;
                }

                if (m_isPressedConvertButton == true)
                {
                    m_grayImage          = m_grayProcessedImage;
                    InitialImage         = ImageConverter.Convert(m_grayImage);
                    m_grayProcessedImage = null;
                }
                else
                {
                    m_colorImage          = m_colorProcessedImage;
                    InitialImage          = ImageConverter.Convert(m_colorImage);
                    m_colorProcessedImage = null;
                }

                ProcessedImage = null;
                OnPropertyChanged("InitialImage");
                OnPropertyChanged("ProcessedImage");
                break;
            }

            case false:
            {
                if (m_grayProcessedImage == null)
                {
                    System.Windows.MessageBox.Show("Doesn't exist processed image.");
                    return;
                }

                m_grayImage          = m_grayProcessedImage;
                InitialImage         = ImageConverter.Convert(m_grayImage);
                m_grayProcessedImage = null;
                ProcessedImage       = null;
                OnPropertyChanged("InitialImage");
                OnPropertyChanged("ProcessedImage");
                break;
            }
            }
        }
        public void Binomial7x7(object parameter)
        {
            if (m_isColorImage == true)
            {
                System.Windows.MessageBox.Show("Please load an grayscale image for this filter!");
            }

            if (m_grayImage != null)
            {
                m_grayProcessedImage = Binomial.Binomial7(m_grayImage);
                ProcessedImage       = ImageConverter.Convert(m_grayProcessedImage);
                OnPropertyChanged("ProcessedImage");
                WriteIntoFile("Binomial 7x7 filter.");
                return;
            }
        }
        public void ConvertToGray(object parameter)
        {
            if (m_isColorImage == true)
            {
                m_grayProcessedImage = Tools.Convert(m_colorImage);
                ProcessedImage       = ImageConverter.Convert(m_grayProcessedImage);
                OnPropertyChanged("ProcessedImage");
                m_isPressedConvertButton = true;
                m_isColorImage           = false;
                return;
            }

            System.Windows.MessageBox.Show(m_colorImage != null
               ? "It is possible to copy only colored images."
               : "Please add a colored image first.");
        }
        public void LoadColorImage(object parameter)
        {
            ResetUiToInitial(parameter);

            var op = new OpenFileDialog();

            op.Title  = "Select a picture";
            op.Filter = "Image files(*.jpg, *.jpeg, *.jpe, *.bmp, *.png) | *.jpg; *.jpeg; *.jpe; *.bmp; *.png";
            op.ShowDialog();
            if (op.FileName.CompareTo("") == 0)
            {
                return;
            }

            m_colorImage = new Image <Bgr, byte>(op.FileName);
            InitialImage = ImageConverter.Convert(m_colorImage);
            OnPropertyChanged("InitialImage");
            m_isColorImage = true;
            System.IO.File.WriteAllText(path, string.Empty);
        }
 public void InvertImage(object parameter)
 {
     if (m_grayImage != null)
     {
         m_grayProcessedImage = Tools.Invert(m_grayImage);
         ProcessedImage       = ImageConverter.Convert(m_grayProcessedImage);
         OnPropertyChanged("ProcessedImage");
         WriteIntoFile("Invert grayscale image.");
     }
     else if (m_colorImage != null)
     {
         m_colorProcessedImage = Tools.Invert(m_colorImage);
         ProcessedImage        = ImageConverter.Convert(m_colorProcessedImage);
         OnPropertyChanged("ProcessedImage");
         WriteIntoFile("Invert color image.");
     }
     else
     {
         MessageBox.Show("Please add an image!");
     }
 }
 public void CopyImage(object parameter)
 {
     if (m_isColorImage == true)
     {
         m_colorProcessedImage = Tools.Copy(m_colorImage);
         ProcessedImage        = ImageConverter.Convert(m_colorProcessedImage);
         OnPropertyChanged("ProcessedImage");
         WriteIntoFile("Copy color image.");
         return;
     }
     else
     {
         if (m_grayImage != null)
         {
             m_grayProcessedImage = Tools.Copy(m_grayImage);
             ProcessedImage       = ImageConverter.Convert(m_grayProcessedImage);
             OnPropertyChanged("ProcessedImage");
             WriteIntoFile("Copy grayscale image.");
             return;
         }
     }
     System.Windows.MessageBox.Show("Please add an image.");
 }