Structure Matrices and Convolution Kernels
Structure Matrices and Convolution Kernels
Constructing matrices with special shapes.
This creates a matrix of 0s containing a radius 4 diamond of 1s. The result is a 9×9 matrix:
The size of the matrix can be explicitly specified:
This creates a matrix containing an ellipse and displays it graphically:
The shape matrix family of functions can make arrays with any rank:
GaussianMatrix [{{r1,…},{σ1,…}}]
a (2r1+1)× … array that samples a Gaussian with standard deviation σi in the ith direction
GaussianMatrix [{{r1,…},{σ1,…}},{n1,…}]
a (2r1+1)× … array that samples the nith discrete derivative in the ith direction of a Gaussian with standard deviation σi in the ith direction
Gaussian matrices.
This creates a radius 2 Gaussian kernel:
GaussianMatrix can construct arrays with any rank:
By default, the matrix elements are numerical and constructed to behave optimally under discrete convolution. Using WorkingPrecision->Infinity will produce an exact representation:
Use Method->"Gaussian" to sample a true Gaussian:
This shows a comparison of the two types of Gaussians:
This specifies a standard deviation of 1 in both directions of a rectangular Gaussian matrix:
Plot the second derivative of the Gaussian in the row direction:
Sum derivatives by using nested List objects in the second argument. For example, this plots the Laplacian:
This finds the length of the vector which has a minimum of 95% of the integrated fraction of the Gaussian with standard deviation 1:
This finds the dimensions of the matrix which, in each direction, has a minimum of 95% of the integrated fraction of the Gaussian with standard deviation 1: