Skip to main content

ImageEdgeDetection

ImageEdgeDetection [flags] Method ImageMatrix

The ImageEdgeDetection operation performs one of several standard image edge detection operations on the source wave ImageMatrix.

Unless the /O flag is specified, the resulting image is saved in the wave M_ImageEdges or in the wave specified by the /DEST flag.

The edge detection operations below produce binary images on output; the background is set to 0 and the edges to 255. This is due, in most cases to a thresholding performed in the final stage.

Except for the case of marr and shen detectors, you can use the /M flag to specify a method for automatic thresholding; see the ImageThreshold /M flag.

Parameters

Method selects type of edge detection. Method is one of the following names:

cannyCanny edge detector uses smoothing before edge detection and thresholding. You can optionally specify the threshold using the /T flag and the smoothing factor using /S.
freiCalculates the Frei-Chen edge operator (see Pratt p. 503) using only the row and column filters.
kirschKirsch edge detector (see Pratt p. 509). Performs convolution with 8 masks calculating gradients.
marrMarr-Hildreth edge detector. Performs two convolutions with Laplacian of Gaussian and then detects zero crossings. Use the /S flag to define the width of the convolution kernel.
prewittCalculates the Prewitt compass gradient filters. Returns the result for the largest filter response.
robertsCalculates the square root of the magnitude squared of the convolution with the Robert's row and column edge detectors.
shenShen-Castan optimized edge detector. Supposed to be effective in the presence of noise. The flags that modify this operation are: /F for the threshold ratio (0.9 by default), /S for smoothness factor (0.9 by default), /W for window width (default is 10 ), /H for thinning factor which by default is 1.
sobelSobel edge detector using convolutions with row and column edge gradient masks (see Pratt p. 501).

Flags

/DEST=destWave
Specifies the output wave.
It is an error to specify the same wave as both ImageMatrix and destWave.
When used in a function, ImageBlend creates a real wave reference for the destWave. See Automatic Creation of Wave References for details.
/DEST flag was added in Igor Pro 10.00.
/F=fractionDetermines the threshold value for the shen algorithm by starting from the histogram of the image and choosing a threshold such that fraction specifies the portion of the image pixels whose values are below the threshold. Valid values are in the interval (0 < fraction < 1).
/FREECreates destWave as a free wave. Note that /FREE does not affect the default output wave M_ImageEdges.
/FREE is allowed only in functions and only if destWave is a simple name or wave reference structure field.
See Free Waves for more discussion.
The /FREE flag was added in Igor Pro 10.00.
/H=thinningUed in shen for thinning the edges. By default the thinning value is 1. Higher values produce thinner edges.
/Iinverts the output, i.e., sets the edges to 255 and the background to 0.
/M=threshMethod
See ImageThreshold automatic methods for obtaining a threshold value. Methods 1, 2, 4 and 5 are supported in this operation. If you use threshMethod = -1, threshold is not applied.
If you want to apply your own thresholding algorithm, use /M=6 to bypass the thresholding completely. The wave M_RawCanny contains the result regardless of any other flags you may have used.
/NSets the background level to 64 (i.e., NaN)
/OOverwrites the source image with the output image.
/P=layerApplies the operation to the specified layer of a 3D wave.
/P is incompatible with /O.
/P was added in Igor Pro 7.00.
/R=roiSpecSpecify a region of interest (ROI). The ROI is defined by a wave of type unsigned byte (/b/u). The ROI wave must have the same number of rows and columns as the image wave. The ROI itself is defined by the entries/pixels whose values are 0. Pixels outside the ROI can take any nonzero value. The ROI does not have to be contiguous and can take any arbitrary shape. See ImageGenerateROIMask for more information on creating ROI waves.
In general, the roiSpec has the form {roiWaveName , roiFlag }, where roiFlag can take the following values:
roiFlagMeaning
0set pixels outside the ROI to 0
1set pixels outside the ROI as in original image
2set pixels outside the ROI to NaN (=64)
By default roiFlag is set to 1 and it is then possible to use the /R flag using the abbreviated form /R=roiWave .
/S= smoothValSpecify the standard deviation or the width of the smoothing filter. By default the operation uses 1. Larger values require longer computation time. In the shen operation the default value is 0.9 and the valid range is (0 < smoothVal< 1).
/T=threshManual threshold for any method above that uses a single threshold. This is faster than using /M.
/W=widthUsed in the shen operation to specify window width. By default width is set to 10 and it is clipped to 49.

See Also

Image Processing, Edge Detectors, ImageGenerateROIMask, ImageThreshold

References

Pratt, William K., Digital Image Processing, John Wiley, New York, 1991.