Core Optical, Inc.
LoGEdgeDetector GetEdgeMask Method Industrial Strength, Scientific Grade
Applies the "Laplacian of Gaussian" edge detection algorithm to the source data and returns a BinaryMask object containing the result. The original data is not altered.

Namespace: PrecisionImage.FeatureProcessing
Assembly: PrecisionImage (in PrecisionImage.dll) Version: 2.0.0.0 (2.0.0.0)
Syntax

public BinaryMask GetEdgeMask(
	SourceData sourceData,
	int channel
)

Return Value

A BinaryMask object with the edges masked and the rest of the image unmasked. If the inverse is desired call Invert  after retrieving the result.
Exceptions

ExceptionCondition
OnlineSystem ArgumentNullException Thrown when sourceData is null.
OnlineSystem ArgumentOutOfRangeException Thrown when channel specifies a channel that is not contained within the sourceData object.
OnlineSystem ArgumentOutOfRangeException Thrown when the kernel dimensions exceed the dimensions of sourceData.
Examples

The following example illustrates the output of the Laplacian of Gaussian edge-detection algorithm using 3 different settings:

using System.PrecisionImage;
using System.FeatureProcessing;

// Read the source (16-bit) image from disk and load into a SourceData object: 
Uri imageUri                   = new Uri("HorseStatueXray.tif", UriKind.Relative);
TiffBitmapDecoder imageDecoder = new TiffBitmapDecoder(imageUri, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);
BitmapSource SourceImage       = imageDecoder.Frames[0];
SourceData imageData           = new SourceData(SourceImage, GammaEncoding.None);

// Display original image in Image component:
image1.Source = SourceImage;

// Instantiate a LogEdgeDetector object to process the data: 
LoGEdgeDetector edgeDetector = new LoGEdgeDetector();

// Set the edge detection parameters:
edgeDetector.KernelRadius = 3;
edgeDetector.Sigma        = 2.0f;

// Generate the edge mask and display: 
BinaryMask edgeMask = edgeDetector.GetEdgeMask(imageData, 0);
image2.Source       = edgeMask.GetMaskImage();

// Alter the parameters of the edge detector:
edgeDetector.KernelRadius = 5;
edgeDetector.Sigma        = 3.0f;

// Generate the edge mask and display:
edgeMask      = edgeDetector.GetEdgeMask(imageData, 0);
image2.Source = edgeMask.GetMaskImage();

// Alter the parameters of the edge detector:
edgeDetector.KernelRadius = 9;
edgeDetector.Sigma        = 4.0f;

// Generate the edge mask and display:
edgeMask      = edgeDetector.GetEdgeMask(imageData, 0);
image2.Source = edgeMask.GetMaskImage();

The above example generates the following images:

See Also