This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

GradientFilter

Updated In 8 Graphic
GradientFilter
gives an image corresponding to the magnitude of the gradient of image, computed using discrete derivatives of a Gaussian of pixel radius r.
GradientFilter
uses a Gaussian with standard deviation .
GradientFilter
uses a Gaussian with radii etc. in vertical and horizontal directions.
GradientFilter
applies gradient filtering to an array of data.
  • GradientFilter works with arbitrary grayscale and multichannel images.
  • For multichannel images, GradientFilter computes the n-dimensional gradient magnitude, taken in the spatial direction in which the pixel vectors vary the most. Variation of the pixel vectors along a given direction is defined by the Euclidean norm of the dot product between the Jacobian matrix of the first spatial derivatives and .
  • The following options can be specified:
Method"Bessel"convolution kernel
Padding"Fixed"padding method
WorkingPrecisionAutomaticthe precision to use
"NonMaxSuppression"Falsewhether to use non-maximum suppression
  • GradientFilter by default gives an image of the same dimensions as image.
  • In GradientFilter, data can be an array of any rank, and can contain symbolic as well as numerical entries.
  • Possible settings for Method include:
"Bessel"standardized Bessel derivative kernel, used for Canny edge detection
"Gaussian"standardized Gaussian derivative kernel, used for Canny edge detection
"ShenCastan"first-order derivatives of exponentials
"Sobel"binomial generalizations of the Sobel edge detection kernels
{kernel1,kernel2,...}explicit kernels specified for each dimension
Gradient filtering of a multichannel image:
Adjusted gradient filter of a grayscale image:
Apply gradient filtering to a vector of numbers:
Gradient filtering of a multichannel image:
In[1]:=
Click for copyable input
Out[1]=
 
Adjusted gradient filter of a grayscale image:
In[1]:=
Click for copyable input
Out[1]=
 
Apply gradient filtering to a vector of numbers:
In[1]:=
Click for copyable input
Out[1]=
Compute the gradient magnitude using Prewitt kernels:
Typically, corners are rounded during gradient filtering:
The Shen-Castan method gives a better corner localization at large scales:
Non-max suppression gives only the ridges of gradient lines:
Use gradient filtering to find edges:
Use gradient filtering as a preprocessing step for watershed segmentation:
Gradient filtering usually results in a dark image with small pixel values:
Adjusting for brightness creates a more visible image gradient:
An artistic effect based on image gradients:
New in 7 | Last modified in 8