skimage2.filters.sobel#

skimage2.filters.sobel(image, mask=None, *, axis=None, mode='reflect', cval=0.0)[source]#

Find edges in an image using the Sobel filter.

Parameters:
imagearray

The input image.

maskarray of bool, optional

Clip the output image to this mask. (Values where mask=0 will be set to 0.)

axisint or sequence of int, optional

Compute the edge filter along this axis. If not provided, the edge magnitude is computed. This is defined as:

sobel_mag = np.sqrt(sum([sobel(image, axis=i)**2
                         for i in range(image.ndim)]) / image.ndim)

The magnitude is also computed if axis is a sequence.

modestr or sequence of str, optional

The boundary mode for the convolution. See scipy.ndimage.convolve for a description of the modes. This can be either a single boundary mode or one boundary mode per axis.

cvalfloat, optional

When mode is 'constant', this is the constant used in values outside the boundary of the image data.

Returns:
outputarray of float

The Sobel edge map.

See also

sobel_h, sobel_v

horizontal and vertical edge detection.

scharr, prewitt, farid, skimage.feature.canny

References

[1]

D. Kroon, 2009, Short Paper University Twente, Numerical Optimization of Kernel Based Image Derivatives.

Examples

>>> from _skimage2 import data
>>> from _skimage2 import filters
>>> camera = data.camera()
>>> edges = filters.sobel(camera)