Detects the edges of the image based on threshold and an input matrix.
public class EdgeDetectEffect : System.Windows.Media.Effects.ShaderEffect, System.Windows.Media.Animation.IAnimatable
Public Class EdgeDetectEffect
Inherits System.Windows.Media.Effects.ShaderEffect
Implements System.Windows.Media.Animation.IAnimatable
public ref class EdgeDetectEffect : public System.Windows.Media.Effects.ShaderEffect, System.Windows.Media.Animation.IAnimatable
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.Windows.Controls
Imports Leadtools.Windows.Media
Imports Leadtools.Windows.Media.Effects
Class EdgeDetectEffectExampleWindow
Inherits Window
Public Sub New()
Dim sp As New StackPanel()
Content = sp
Dim theViewer As New ImageViewer()
theViewer.HorizontalAlignment = HorizontalAlignment.Center
theViewer.VerticalAlignment = VerticalAlignment.Top
theViewer.ImageHorizontalAlignment = HorizontalAlignment.Left
theViewer.ImageVerticalAlignment = VerticalAlignment.Top
sp.Children.Add(theViewer)
' Create the sliders
Dim tb As New TextBlock()
tb.HorizontalAlignment = HorizontalAlignment.Center
tb.Text = "Threshold:"
sp.Children.Add(tb)
Dim theSlider As 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 viewer
theViewer.Source = New BitmapImage(New Uri(System.IO.Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg")))
' Create the effect
Dim effect As New EdgeDetectEffect()
effect.Threshold = 0.1F
theViewer.ImageEffect = effect
' Bind the properties
Dim bind As New Binding()
bind.Source = effect
bind.UpdateSourceTrigger = UpdateSourceTrigger.PropertyChanged
bind.Path = New PropertyPath("Threshold")
theSlider.SetBinding(Slider.ValueProperty, bind)
Title = "Using EdgeDetectEffect"
End Sub
End Class
Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
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 sliders
TextBlock 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 viewer
theViewer.Source = new BitmapImage(new Uri(System.IO.Path.Combine(LEAD_VARS.ImagesDir, "Cannon.jpg")));
// Create the effect
EdgeDetectEffect effect = new EdgeDetectEffect();
effect.Threshold = 0.1f;
theViewer.ImageEffect = effect;
// Bind the properties
Binding 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:\Users\Public\Documents\LEADTOOLS Images";
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.Windows.Media;
using Leadtools.Windows.Media.Effects;
using Leadtools.Windows.Controls;
class EdgeDetectEffectExampleWindow : UserControl
{
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 sliders
TextBlock 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;
sp.Children.Add(theSlider);
// Load an image into the viewer
theViewer.Source = new BitmapImage(new Uri(LeadtoolsExamples.Common.ImagesPath.Path + "Cannon.jpg"));
// Create the effect
EdgeDetectEffect effect = new EdgeDetectEffect();
effect.Threshold = 0.1f;
theViewer.ImageEffect = effect;
// Bind the properties
Binding bind = new Binding();
bind.Source = effect;
bind.UpdateSourceTrigger = UpdateSourceTrigger.Default;
bind.Path = new PropertyPath("Threshold");
theSlider.SetBinding(Slider.ValueProperty, bind);
}
}
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.Windows.Controls
Imports Leadtools.Windows.Media
Imports Leadtools.Windows.Media.Effects
Class EdgeDetectEffectExampleWindow
Inherits UserControl
Public Sub New()
Dim sp As New StackPanel()
Content = sp
Dim theViewer As New ImageViewer()
theViewer.HorizontalAlignment = HorizontalAlignment.Center
theViewer.VerticalAlignment = VerticalAlignment.Top
theViewer.ImageHorizontalAlignment = HorizontalAlignment.Left
theViewer.ImageVerticalAlignment = VerticalAlignment.Top
sp.Children.Add(theViewer)
' Create the sliders
Dim tb As New TextBlock()
tb.HorizontalAlignment = HorizontalAlignment.Center
tb.Text = "Threshold:"
sp.Children.Add(tb)
Dim theSlider As New Slider()
theSlider.Minimum = 0.0
theSlider.Maximum = 1.0
theSlider.Width = 400
theSlider.Orientation = Orientation.Horizontal
sp.Children.Add(theSlider)
' Load an image into the viewer
theViewer.Source = New BitmapImage(New Uri(LeadtoolsExamples.Common.ImagesPath.Path + "Cannon.jpg"))
' Create the effect
Dim effect As New EdgeDetectEffect()
effect.Threshold = 0.1F
theViewer.ImageEffect = effect
' Bind the properties
Dim bind As New Binding()
bind.Source = effect
bind.UpdateSourceTrigger = UpdateSourceTrigger.Default
bind.Path = New PropertyPath("Threshold")
theSlider.SetBinding(Slider.ValueProperty, bind)
End Sub
End Class
<Window x:Class="EdgeDetectEffectExample"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:leadControls="clr-namespace:Leadtools.Windows.Controls;assembly=Leadtools.Windows.Controls"
xmlns:leadEffects="clr-namespace:Leadtools.Windows.Media.Effects;assembly=Leadtools.Windows.Media.Effects"
Height="600" Width="800">
<StackPanel>
<leadControls:ImageViewer
HorizontalAlignment="Center" VerticalAlignment="Top"
ImageHorizontalAlignment="Left" ImageVerticalAlignment="Top"
Source="file:///c:\users\Public\Documents\LEADTOOLS Images\cannon.jpg">
<leadControls:ImageViewer.ImageEffect>
<leadEffects:EdgeDetectEffect
Threshold="{Binding Value, ElementName=ThresholdSlider, UpdateSourceTrigger=PropertyChanged}">
</leadEffects:EdgeDetectEffect>
</leadControls:ImageViewer.ImageEffect>
</leadControls:ImageViewer>
<TextBlock HorizontalAlignment="Center" Text="Threshold:"/>
<Slider x:Name="ThresholdSlider"
Minimum="0.0" Maximum="1.0" TickFrequency="0.1"
Width="400" Orientation="Horizontal"
IsSnapToTickEnabled="True" TickPlacement="BottomRight"
AutoToolTipPrecision="2" AutoToolTipPlacement="BottomRight">
</Slider>
</StackPanel>
</Window>
Products |
Support |
Feedback: EdgeDetectEffect Class - Leadtools.Windows.Media.Effects |
Introduction |
Help Version 19.0.2017.3.21
|
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.