Create spatial filters for image processing.
type is a string specifying the filter name. The input arguments
that follow are type specific. The return value is a correlation kernel,
often to be used by imfilter
.
See also: conv2, convn, filter2, imfilter.
Rectangular averaging filter.
The optional argument lengths controls the size of the filter. If lengths is an integer N, a N by N filter is created. If it is a two-vector with elements N and M, the resulting filter will be N by M. By default a 3 by 3 filter is created.
Circular averaging filter.
The optional argument radius controls the radius of the filter. If radius is an integer R, a 2 R + 1 filter is created. By default a radius of 5 is used. If the returned matrix corresponds to a Cartesian grid, each element of the matrix is weighted by how much of the corresponding grid square is covered by a disk of radius R and centred at the middle of the element R+1,R+1.
Create Gaussian filter.
Returns a N dimensional Gaussian distribution with standard deviation sigma and centred in an array of size lengths.
lengths defaults to [3 3]
and sigma to 0.5.
If lengths is a scalar, it returns a square matrix of side
lengths, .i.e., its value defines both the number of rows and
columns.
Laplacian of Gaussian.
The optional argument lengths controls the size of the filter. If lengths is an integer N, a N by N filter is created. If it is a two-vector with elements N and M, the resulting filter will be N by M. By default a 5 by 5 filter is created. The optional argument std sets spread of the filter. By default a spread of 0.5 is used.
3x3 approximation of the laplacian.
The filter is approximated as
(4/(alpha+1)) * [ alpha/4 (1-alpha)/4 alpha/4 (1-alpha)/4 -1 (1-alpha)/4 alpha/4 (1-alpha)/4 alpha/4 ];
where alpha is a number between 0 and 1. By default it is 0.2.
Sharpening filter.
The following filter is returned
(1/(alpha+1)) * [-alpha alpha-1 -alpha alpha-1 alpha+5 alpha-1 -alpha alpha-1 -alpha];
where alpha is a number between 0 and 1. By default it is 0.2.
Motion blur filter of width 1 pixel.
The optional input argument lengths controls the length of the filter, which by default is 9. The argument angle controls the angle of the filter, which by default is 0 degrees.
Horizontal Sobel edge filter.
The following filter is returned
[ 1 2 1 0 0 0 -1 -2 -1 ]
Horizontal Prewitt edge filter.
The following filter is returned
[ 1 1 1 0 0 0 -1 -1 -1 ]
Horizontal Kirsch edge filter.
The following filter is returned
[ 3 3 3 3 0 3 -5 -5 -5 ]
Package: image