# Wolfram Language & System 10.0 (2014)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.
BUILT-IN WOLFRAM LANGUAGE SYMBOL

# GaussianMatrix

gives a matrix that corresponds to a Gaussian kernel of radius r.

GaussianMatrix[{r,σ}]
gives a matrix corresponding to a Gaussian kernel with radius r and standard deviation σ.

GaussianMatrix[r,{n1,n2}]
gives a matrix formed from the derivative of the Gaussian with respect to rows and the derivative with respect to columns.

GaussianMatrix[r,{{n11,n12},{n21,n22},}]
gives a matrix formed from the sums of the and derivatives.

GaussianMatrix[{{r1,r2,},σ},]
gives an array corresponding to a Gaussian kernel with radius in the i index direction.

## Details and OptionsDetails and Options

• gives values that approximate at index position from the center, where .
• By default, the elements of sum to 1.
• GaussianMatrix[,{n1,n2}] by default constructs discrete derivatives as finite differences.
• GaussianMatrix[r,{{2,0},{0,2}}] gives a matrix formed from the Laplacian of a Gaussian.
• GaussianMatrix[{Automatic,σ,f},] constructs a matrix just large enough to include at least a fraction f of the discrete integral of a Gaussian in each direction.
• Any of the r, σ, and f can be lists, specifying different values for different directions.
• For integer r, GaussianMatrix[r,] yields a × matrix.
• For noninteger r, the value of r is effectively rounded to an integer.
• The following options can be specified:
•  Method "Bessel" how to determine matrix elements WorkingPrecision Automatic the precision with which to compute matrix elements "Standardization" True whether to rescale and shift the matrix to account for truncation
• Possible settings for the Method option are and .
• With the default option setting Method->"Bessel", has elements proportional to , yielding a kernel with optimal discrete convolution properties.
• For Method->"Bessel", derivatives of the Gaussian are obtained by the finite difference operator. GaussianMatrix[{r,}] satisfies the finite difference equation .
• With Method->"Gaussian", has elements proportional to the raw continuous functional form .
• For Method->"Gaussian", derivatives of the Gaussian are proportional to the partial derivatives of the functional form. The GaussianMatrix[{r,}] approximately satisfies the differential equation .
• With , the elements of will sum to 1. However, the elements of GaussianMatrix[r,{n1,n2,}] with at least one nonzero will sum to 0, and the sum of the elements, weighted in each direction by times the distance from the origin to the power of , will be 1.
• With "Standardization"->True, the proportionality factor ensures that the elements of sum to 1. However, the elements of GaussianMatrix[r,{n1,n2,}] with at least one nonzero will sum to 0, and the sum of the elements, weighted in each direction by times the distance from the origin to the power of , will be 1.
• With "Standardization"->False, no proportionality factor is used.

## BackgroundBackground

• GaussianMatrix is a constructor function that returns a matrix having a Gaussian profile. Such matrices are typically used as kernels in image convolution for smoothing or taking derivatives of images.
• The function ImageConvolve can be used to perform convolution on an image using a Gaussian matrix kernel. Other functions that create smoothing or derivative kernel matrices include ShenCastanMatrix and SavitzkyGolayMatrix. Note that non-smooth kernels can also be used to smooth images. Binary kernels commonly used for this purpose include DiskMatrix, DiamondMatrix, and other similar functions.

## ExamplesExamplesopen allclose all

### Basic Examples  (3)Basic Examples  (3)

Compute and plot a Gaussian matrix:

 Out[1]=

Compute and plot a Gaussian vector:

 Out[1]=

First derivative of a Gaussian matrix in the vertical dimension:

 Out[1]=

### Possible Issues  (1)Possible Issues  (1)

Introduced in 2008
(7.0)
| Updated in 2010
(8.0)