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)); }
private void LoadImage() { EmguCV.LoadImage(); originalImage.Source = EmguCV.GetOriginalBitmap(); resultImage.Source = EmguCV.GetResultBitmap(); saveImageButton.IsEnabled = true; ProcessImage(); }
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; }
private System.Drawing.Point DetectFish() { return(EmguCV.FindContour()); }
private void SaveImage() { EmguCV.SaveImage(); }