예제 #1
0
 private void GrayScale_Click(object sender, RoutedEventArgs e)
 {
     if (imageControl == null || imageControl.Source == null)
     {
         return;
     }
     imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.ToGray(originalImage));
 }
예제 #2
0
 private void BinSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     changeInvoker = ChangeInvoker.Binarization;
     if (imageControl == null || imageControl.Source == null || InteractiveMode.IsChecked != true)
     {
         return;
     }
     imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.ChangeBin(originalImage, (int)BinSlider1.Value, (int)BinSlider2.Value));
 }
예제 #3
0
 private void BrightnessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     changeInvoker = ChangeInvoker.Brightness;
     if (imageControl == null || imageControl.Source == null || InteractiveMode.IsChecked != true)
     {
         return;
     }
     float[] kernel = new float[9];
     kernel[0]           = ((float)BrightnessSlider1.Value) / 10;
     kernel[1]           = ((float)BrightnessSlider2.Value) / 10;
     kernel[2]           = ((float)BrightnessSlider3.Value) / 10;
     kernel[3]           = ((float)BrightnessSlider4.Value) / 10;
     kernel[4]           = ((float)BrightnessSlider5.Value) / 10;
     kernel[5]           = ((float)BrightnessSlider6.Value) / 10;
     kernel[6]           = ((float)BrightnessSlider7.Value) / 10;
     kernel[7]           = ((float)BrightnessSlider8.Value) / 10;
     kernel[8]           = ((float)BrightnessSlider9.Value) / 10;
     imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.ChangeBrighness(originalImage, kernel));
 }
예제 #4
0
        private void GetResult_Click(object sender, RoutedEventArgs e)
        {
            if (MainImage.Source == null)
            {
                return;
            }

            var image = SourceBitmapConverter.BitmapFromSource(MainImage.Source);

            image = CvProcessor.AdaptiveThreshold(image, 200, 101);
            Bitmap result;
            List <BloodObjects> objects = new List <BloodObjects>();

            ContoursEngine.GetAllObjects(image, out result, out objects, "");
            MainImage.Source = SourceBitmapConverter.ImageSourceFromBitmap(result);
            table.Show();
            table.Activate();
            table.PopulateData(objects, MainImage, fileName);
        }
예제 #5
0
        private void Apply_Click(object sender, RoutedEventArgs e)
        {
            if (imageControl == null || imageControl.Source == null)
            {
                return;
            }
            switch (changeInvoker)
            {
            case ChangeInvoker.Smooth:
                imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.ChangeSmooth(originalImage, (int)SmoothSlider.Value));
                break;

            case ChangeInvoker.Brightness:
                float[] kernel = new float[9];
                kernel[0]           = ((float)BrightnessSlider1.Value) / 10;
                kernel[1]           = ((float)BrightnessSlider2.Value) / 10;
                kernel[2]           = ((float)BrightnessSlider3.Value) / 10;
                kernel[3]           = ((float)BrightnessSlider4.Value) / 10;
                kernel[4]           = ((float)BrightnessSlider5.Value) / 10;
                kernel[5]           = ((float)BrightnessSlider6.Value) / 10;
                kernel[6]           = ((float)BrightnessSlider7.Value) / 10;
                kernel[7]           = ((float)BrightnessSlider8.Value) / 10;
                kernel[8]           = ((float)BrightnessSlider9.Value) / 10;
                imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.ChangeBrighness(originalImage, kernel));
                break;

            case ChangeInvoker.Canny:
                imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.Canny(originalImage, (int)CannySlider1.Value, (int)CannySlider2.Value, (int)CannySlider3.Value));
                break;

            case ChangeInvoker.Threshold:
                imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.AdaptiveThreshold(originalImage, (int)AdaptiveSlider1.Value, (int)AdaptiveSlider2.Value));
                break;

            case ChangeInvoker.Binarization:
                imageControl.Source = SourceBitmapConverter.ImageSourceFromBitmap(CvProcessor.ChangeBin(originalImage, (int)BinSlider1.Value, (int)BinSlider2.Value));
                break;
            }

            originalImage = SourceBitmapConverter.BitmapFromSource(imageControl.Source);
        }