Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

edge3

Find edges in 3-D intensity volume

Syntax

BW = edge3(V,'approxcanny',thresh)
BW = edge3(V,'approxcanny',thresh,sigma)
BW = edge3(V,'Sobel',thresh)
BW = edge3(V,'Sobel',thresh,'nothinning')

Description

BW = edge3(V,'approxcanny',thresh) returns the edges found in the intensity or a binary volume V using the approximate Canny method. The approximate Canny method finds edges by looking for local maxima of the gradient of V. edge3 calculates the gradient using the derivative of a Gaussian smoothed volume.

For the approximate Canny method, thresh is a two-element vector in which the first element is the low threshold, and the second element is the high threshold, [lowthresh highthresh]. If you specify a scalar for thresh, edge3 uses this value for the high threshold and 0.4*thresh for the low threshold.

The approximate Canny method uses two thresholds to detect strong and weak edges, and includes the weak edges in the output only if they are connected to strong edges. This method is more likely than the Sobel method to detect true weak edges.

example

BW = edge3(V,'approxcanny',thresh,sigma) returns the edges found in the intensity or binary volume V, where sigma is a scalar that specifies the standard deviation of the Gaussian smoothing filter. sigma can also be a 1-by-3 vector, [SigmaX,SigmaY,SigmaZ], specifying different standard deviations in each direction. For anisotropic volumes that have different scales in each direction, use mulitiple sigma values. By default, sigma is sqrt(2) and is isotropic. edge3 chooses the size of the filter automatically, based on sigma.

example

BW = edge3(V,'Sobel',thresh) accepts an intensity or a binary volume V and returns a binary volume BW, that is the same size as V, with 1s where the function finds edges in V and 0s elsewhere.

The Sobel method finds edges using the Sobel approximation to the derivative. It returns edges at those points where the gradient of V is maximum.

thresh is a scalar that specifies the sensitivity threshold for the Sobel method. edge3 ignores all edges that are not stronger than thresh.

BW = edge3(V,'Sobel',thresh,'nothinning') speeds up the operation of the algorithm by skipping the additional edge-thinning stage. By default, or when 'thinning' is specified, the algorithm applies edge thinning.

Examples

collapse all

Load volumetric data and remove any singleton dimensions.

load mri
V = squeeze(D);

Visualize original image.

montage(reshape(V,size(D)),map);

Detect edges in the volume.

BW = edge3(V,'approxcanny',0.6);

Visualize the detected edges. You can also view the result using the Volume Viewer app.

montage(reshape(BW,size(D)))

Input Arguments

collapse all

Input volume, specified as a nonsparse 3-D numeric array.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Sensitivity threshold, specified as a scalar or, for approximate Canny, a 1-by-2 numeric vector of the form [lowthresh highthresh]. If you specify a scalar, edge3 uses this value for the high threshold and 0.4*thresh for the low threshold.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Standard deviation of the Gaussian filter, specified as a scalar or a 1-by-3 numeric vector of the form [SigmaX SigmaY SigmaZ].

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | logical

Output Arguments

collapse all

Binary volume containing 1s indicating edges and 0s elsewhere, returned as a 3-D numeric array, the same size as V.

See Also

Introduced in R2017b

Was this topic helpful?