sobel

sobel

skimage.filters.sobel(image, mask=None) [source]

Find the edge magnitude using the Sobel transform.

Parameters:

image : 2-D array

Image to process.

mask : 2-D array, optional

An optional mask to limit the application to a certain area. Note that pixels surrounding masked regions are also masked to prevent masked regions from affecting the result.

Returns:

output : 2-D array

The Sobel edge map.

See also

scharr, prewitt, roberts, feature.canny

Notes

Take the square root of the sum of the squares of the horizontal and vertical Sobels to get a magnitude that’s somewhat insensitive to direction.

The 3x3 convolution kernel used in the horizontal and vertical Sobels is an approximation of the gradient of the image (with some slight blurring since 9 pixels are used to compute the gradient at a given pixel). As an approximation of the gradient, the Sobel operator is not completely rotation-invariant. The Scharr operator should be used for a better rotation invariance.

Note that scipy.ndimage.sobel returns a directional Sobel which has to be further processed to perform edge detection.

Examples

>>> from skimage import data
>>> camera = data.camera()
>>> from skimage import filters
>>> edges = filters.sobel(camera)
doc_scikit_image
2017-01-12 17:23:33
Comments
Leave a Comment

Please login to continue.