Exemple #1
0
        // event on slider changed value
        private void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
        {
            var slider = sender as Slider;
	        int value = (int)slider.Value;
            string sliderName = slider.Name;
            ImageProcessing process = new ImageProcessing();
            byte[] processedImageBytes;
            switch (sliderName[0])
            {
                // if the slider is "Gaussian BLur"
                case 'g':
                    processedImageBytes = process.setGaussianBlur(originalImageBytes, value);
                    grayscalePanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 4);
                    break;

                // if the sliber is "Brightness"
                case 'b':
                    processedImageBytes = process.setBrightness(originalImageBytes, value-50);
                    grayscalePanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 4);
                    break;

                // if the slider is "Contrast"
                case 'c':
                    processedImageBytes = process.setContrast(originalImageBytes, value-100);
                    grayscalePanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 4);
                    break;

                // if smth stupid happend
                default:
                    break;
            }
        }
 private void Button_Click_3(object sender, RoutedEventArgs e)
 {
     processedImageBytes   = ImageProcessing.getDifferenceOfGaussins(originalImageBytes);
     grayscalePanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 1);
 }
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     processedImageBytes   = ImageProcessing.markEdges(originalImageBytes);
     grayscalePanel.Source = ImageConvertor.ByteArrayToImage(processedImageBytes, originalImage.PixelWidth, originalImage.PixelHeight, 4);
 }