FUNCTION REFERENCE

fspecial

Create a predefined 2-D filter.

Create a predefined 2-D filter.

Syntax

h = fspecial(type)

Syntax

h = fspecial(type, parameters)

'average' (hsize, default 3): ones(hsize)/numel. 'gaussian' (hsize 3, sigma 0.5): exp(-(x^2+y^2)/(2 sigma^2)) normalised to sum 1. 'log' (hsize 5, sigma 0.5): (x^2+y^2-2 sigma^2) hg/(sigma^4 sum(hg)), shifted so the kernel sums to 0. 'laplacian' (alpha 0.2): 4/(alpha+1) [alpha/4 (1-alpha)/4 alpha/4; (1-alpha)/4 -1 (1-alpha)/4; alpha/4 (1-alpha)/4 alpha/4]. 'unsharp' (alpha 0.2): 1/(alpha+1) [-alpha alpha-1 -alpha; alpha-1 alpha+5 alpha-1; -alpha alpha-1 -alpha]. 'prewitt' [1 1 1; 0 0 0; -1 -1 -1] and 'sobel' [1 2 1; 0 0 0; -1 -2 -1] (horizontal edges; transpose for vertical). hsize is n or [rows cols].

Example

fspecial('average', 2)   % 0.25 * ones(2)

Example

fspecial('sobel')   % [1 2 1; 0 0 0; -1 -2 -1]

Example

fspecial('gaussian', 5, 1)

Differences from MATLAB: 'disk' and 'motion' are not supported yet.

These are the engine’s help pages. Each page keeps its compatibility notes. File operations are unavailable in the browser.