M-File Help: iwindow View code for iwindow

iwindow

Generalized spatial operator

out = iwindow(im, se, func) is an image where each pixel is the result of applying the function func to a neighbourhood centred on the corresponding pixel in im. The neighbourhood is defined by the size of the structuring element se which should have odd side lengths. The elements in the neighbourhood corresponding to non-zero elements in se are packed into a vector (in column order from top left) and passed to the specified function handle func. The return value becomes the corresponding pixel value in out.

out = iwindow(image, se, func, edge) as above but performance of edge pixels can be controlled. The value of edge is:

'border' the border value is replicated (default)
'none' pixels beyond the border are not included in the window
'trim' output is not computed for pixels whose window crosses the border, hence output image had reduced dimensions.
'wrap' the image is assumed to wrap around

Example

Compute the maximum value over a 5x5 window:

iwindow(im, ones(5,5), @max);

Compute the standard deviation over a 3x3 window:

iwindow(im, ones(3,3), @std);

Notes

See also

ivar, irank


 

© 1990-2012 Peter Corke.