% -*- texinfo -*- % @deftypefn {Function File} {@var{filter} = } fspecial(@var{type}, @var{arg1}, @var{arg2}) % Create spatial filters for image processing. % % @var{type} determines the shape of the filter and can be % @table @t % @item 'average' % Rectangular averaging filter. The optional argument @var{arg1} controls the % size of the filter. If @var{arg1} is an integer @var{N}, a @var{N} by @var{N} % filter is created. If it is a two-vector with elements @var{N} and @var{M}, the % resulting filter will be @var{N} by @var{M}. By default a 3 by 3 filter is % created. % @item 'disk' % Circular averaging filter. The optional argument @var{arg1} controls the % radius of the filter. If @var{arg1} is an integer @var{N}, a 2 @var{N} + 1 % filter is created. By default a radius of 5 is used. % @item 'gaussian' % Gaussian filter. The optional argument @var{arg1} controls the size of the % filter. If @var{arg1} is an integer @var{N}, a @var{N} by @var{N} % filter is created. If it is a two-vector with elements @var{N} and @var{M}, the % resulting filter will be @var{N} by @var{M}. By default a 3 by 3 filter is % created. The optional argument @var{arg2} sets spread of the filter. By default % a spread of @math{0.5} is used. % @item 'log' % Laplacian of Gaussian. The optional argument @var{arg1} controls the size of the % filter. If @var{arg1} is an integer @var{N}, a @var{N} by @var{N} % filter is created. If it is a two-vector with elements @var{N} and @var{M}, the % resulting filter will be @var{N} by @var{M}. By default a 5 by 5 filter is % created. The optional argument @var{arg2} sets spread of the filter. By default % a spread of @math{0.5} is used. % @item 'laplacian' % 3x3 approximation of the laplacian. The filter is approximated as % @example % (4/(@var{alpha}+1))*[@var{alpha}/4, (1-@var{alpha})/4, @var{alpha}/4; ... % (1-@var{alpha})/4, -1, (1-@var{alpha})/4; ... % @var{alpha}/4, (1-@var{alpha})/4, @var{alpha}/4]; % @end example % where @var{alpha} is a number between 0 and 1. This number can be controlled % via the optional input argument @var{arg1}. By default it is @math{0.2}. % @item 'unsharp' % Sharpening filter. The following filter is returned % @example % (1/(@var{alpha}+1))*[-@var{alpha}, @var{alpha}-1, -@var{alpha}; ... % @var{alpha}-1, @var{alpha}+5, @var{alpha}-1; ... % -@var{alpha}, @var{alpha}-1, -@var{alpha}]; % @end example % where @var{alpha} is a number between 0 and 1. This number can be controlled % via the optional input argument @var{arg1}. By default it is @math{0.2}. % @item 'motion' % Moion blur filter of width 1 pixel. The optional input argument @var{arg1} % controls the length of the filter, which by default is 9. The argument @var{arg2} % controls the angle of the filter, which by default is 0 degrees. % @item 'sobel' % Horizontal Sobel edge filter. The following filter is returned % @example % [ 1, 2, 1; % 0, 0, 0; % -1, -2, -1 ] % @end example % @item 'prewitt' % Horizontal Prewitt edge filter. The following filter is returned % @example % [ 1, 1, 1; % 0, 0, 0; % -1, -1, -1 ] % @end example % @item 'kirsch' % Horizontal Kirsch edge filter. The following filter is returned % @example % [ 3, 3, 3; % 3, 0, 3; % -5, -5, -5 ] % @end example % @end table % @end deftypefn