M-File Help: irank View code for irank

irank

Rank filter

out = irank(im, order, se) is a rank filtered version of im. Only pixels corresponding to non-zero elements of the structuring element se are ranked and the order'th value in rank becomes the corresponding output pixel value. The highest rank, the maximum, is order=1.

out = irank(image, se, op, nbins) as above but the number of histogram bins can be specified.

out = irank(image, se, op, nbins, edge) as above but the processing 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 left-right, top-bottom.

Examples

5x5 median filter, 25 elements in the window, the median is the 12thn in rank

irank(im, 12, ones(5,5));

3x3 non-local maximum, find where a pixel is greater than its eight neighbours

se = ones(3,3); se(2,2) = 0;
im > irank(im, 1, se);

Notes

See also

imorph, ivar, iwindow


 

© 1990-2012 Peter Corke.