Beispiel #1
0
 private void Preprocessing()
 {
     EmguCV.ConvertToGrayscale();
     EmguCV.GaussianBlur(adaptiveKernelSizeCheckBox.IsChecked, adaptiveSigmaCheckBox.IsChecked, Convert.ToInt32(kernelSizeSlider.Value), sigmaXSlider.Value, sigmaYSlider.Value);
     EmguCV.EqualizeHistogram(adaptiveHistogramEqualizationCheckBox.IsChecked);
     EmguCV.Threshold(adaptiveThresholdCheckBox.IsChecked, Convert.ToInt32(thresholdSlider.Value));
 }
Beispiel #2
0
        private void LoadImage()
        {
            EmguCV.LoadImage();
            originalImage.Source = EmguCV.GetOriginalBitmap();
            resultImage.Source   = EmguCV.GetResultBitmap();

            saveImageButton.IsEnabled = true;

            ProcessImage();
        }
Beispiel #3
0
        private void ProcessImage()
        {
            if (!EmguCV.IsImageLoaded() || isUpdateRequired)
            {
                return;
            }

            if (isProcessing && !isUpdateRequired)
            {
                isUpdateRequired = true;
                while (!isProcessing)
                {
                    ;
                }
                isUpdateRequired = false;
            }

            isProcessing = true;

            EmguCV.ReloadResultImage();

            Stopwatch stopwatch = Stopwatch.StartNew();

            Preprocessing();
            preprocessingImage.Source = EmguCV.GetResultBitmap();
            stopwatch.Stop();

            preprocessingTimeTextBox.Text = stopwatch.ElapsedMilliseconds.ToString();

            stopwatch.Restart();
            System.Drawing.Point position = DetectFish();
            stopwatch.Stop();

            detectionTimeTextBox.Text   = stopwatch.ElapsedMilliseconds.ToString();
            objectPositionXTextBox.Text = position.X.ToString();
            objectPositionYTextBox.Text = position.Y.ToString();

            resultImage.Source = EmguCV.GetResultBitmap();

            isProcessing = false;
        }
Beispiel #4
0
 private System.Drawing.Point DetectFish()
 {
     return(EmguCV.FindContour());
 }
Beispiel #5
0
 private void SaveImage()
 {
     EmguCV.SaveImage();
 }