public double Threshold { get; set; }
The threshold used to detect the edge of the image. Default value is 0.5.
using Leadtools;using Leadtools.Codecs;using Leadtools.ImageProcessing;using Leadtools.Windows.Controls;using Leadtools.Windows.Media;using Leadtools.Windows.Media.Effects;class EdgeDetectEffectExampleWindow : Window{public EdgeDetectEffectExampleWindow(){StackPanel sp = new StackPanel();Content = sp;ImageViewer theViewer = new ImageViewer();theViewer.HorizontalAlignment = HorizontalAlignment.Center;theViewer.VerticalAlignment = VerticalAlignment.Top;theViewer.ImageHorizontalAlignment = HorizontalAlignment.Left;theViewer.ImageVerticalAlignment = VerticalAlignment.Top;sp.Children.Add(theViewer);// Create the slidersTextBlock tb = new TextBlock();tb.HorizontalAlignment = HorizontalAlignment.Center;tb.Text = "Threshold:";sp.Children.Add(tb);Slider theSlider = new Slider();theSlider.Minimum = 0.0;theSlider.Maximum = 1.0;theSlider.Width = 400;theSlider.Orientation = Orientation.Horizontal;theSlider.IsSnapToTickEnabled = true;theSlider.TickPlacement = System.Windows.Controls.Primitives.TickPlacement.BottomRight;theSlider.TickFrequency = 0.1;theSlider.AutoToolTipPrecision = 2;theSlider.AutoToolTipPlacement = System.Windows.Controls.Primitives.AutoToolTipPlacement.BottomRight;sp.Children.Add(theSlider);// Load an image into the viewertheViewer.Source = new BitmapImage(new Uri(System.IO.Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg")));// Create the effectEdgeDetectEffect effect = new EdgeDetectEffect();effect.Threshold = 0.1f;theViewer.ImageEffect = effect;// Bind the propertiesBinding bind = new Binding();bind.Source = effect;bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged;bind.Path = new PropertyPath("Threshold");theSlider.SetBinding(Slider.ValueProperty, bind);Title = "Using EdgeDetectEffect";}}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";}