Image Processing Toolbox User's Guide |
Syntax
Description
J = rangefilt(I)
returns the array J, where each output pixel contains the range value (maximum value - minimum value) of the 3-by-3 neighborhood around the corresponding pixel in the input image I
. I can have any dimension. The output image J
is the same size as the input image I
.
J = rangefilt(I,NHOOD)
performs range filtering of the input image I
where you specify the neighborhood in NHOOD
. NHOOD
is a multidimensional array of zeros and ones where the nonzero elements specify the neighborhood for the range filtering operation. NHOOD's
size must be odd in each dimension.
By default, rangefilt
uses the neighborhood true(3)
. rangefilt
determines the center element of the neighborhood by floor((size(NHOOD) + 1)/2)
. For information about specifying neighborhoods, see Notes.
Class Support
I
can be logical or numeric and must be real and nonsparse. NHOOD
can be logical or numeric and must contain zeros or ones.
The output image J
is the same class as I
, except for signed integer data types. The output class for signed data types is the corresponding unsigned integer data type. For example, if the class of I
is int8
, then the class of J
is uint8
.
Notes
rangefilt
uses the morphological functions imdilate
and imerode
to determine the maximum and minimum values in the specified neighborhood. Consequently, rangefilt
uses the padding behavior of these morphological functions.
In addition, to specify neighborhoods of various shapes, such as a disk, use the strel
function to create a structuring element object and then use the getnhood
function to extract the neighborhood from the structuring element object.
Examples
(2-D) Identify the two flying objects by measuring the local range.
(3-D) Quantify land cover changes in an RGB image. The example first converts the image to L*a*b* colorspace to separate intensity information into a single plane of the image, and then calculates the local range in each layer.
I = imread('autumn.tif'); cform = makecform('srgb2lab'); LAB = applycform(I, cform); rLAB = rangefilt(LAB); imshow(I); figure, imshow(rLAB(:,:,1),[]); figure, imshow(rLAB(:,:,2),[]); figure, imshow(rLAB(:,:,3),[]);
See Also
entropyfilt
, getnhood
, imdilate
, imerode
, stdfilt
, strel
radon | reflect |
© 1994-2005 The MathWorks, Inc.