Exemple #1
0
        // click on processing buttons
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string buttonName = (sender as Button).Name.ToString();
            ImageProcessing process = new ImageProcessing();
            byte[] processedImageBytes;
            switch (buttonName[0])
            {
                // if the button is "Binary"
                case 'b':
                    processedImageBytes = process.setBinary(originalImageBytes);
                    processedPanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);
                    break;

                // if the button is "Erosion"
                case 'e':
                    processedImageBytes = process.setErosion(originalImageBytes);
                    processedPanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);
                    break;

                // if the button is "Dilatation"
                case 'd':
                    processedImageBytes = process.setDilatation(originalImageBytes);
                    processedPanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);
                    break;

                // if the button is "Edge"
                case 'c':
                    processedImageBytes = process.setEdges(originalImageBytes);
                    processedPanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);
                    break;

                // if smth stupid happend
                default:
                    break;
            }

        }