Esempio n. 1
0
        private void ExtractRawRect_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Convert the original image to grayscale
                Convolution2D image = GetOriginalImageGrays();
                if (image == null)
                {
                    // The original image is empty
                    MessageBox.Show("Please load an image first", this.Title, MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                // Rectangle
                RectInt rect = Convolutions.GetExtractRectangle(new VectorInt(image.Width, image.Height), false);

                // Extract
                AddKernel(image.Extract(rect, ConvolutionExtractType.RawUnit));
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), this.Title, MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }