Image Processing Toolbox User's Guide Previous page   Next Page
stretchlim

Find limits to contrast stretch an image

Syntax

Description

LOW_HIGH = stretchlim(I) returns LOW_HIGH, a two-element vector of pixel values that specify lower and upper limits that can be used for contrast stretching image I. By default, values in LOW_HIGH specify the bottom 1% and the top 1% of all pixel values. The gray values returned can be used by the imadjust function to increase the contrast of an image.

LOW_HIGH = stretchlim(I,TOL) where TOL is a two-element vector [LOW_FRACT HIGH_FRACT] that specifies the fraction of the image to saturate at low and high pixel values.

If TOL is a scalar, LOW_FRACT = TOL, and HIGH_FRACT = 1 - LOW_FRACT, which saturates equal fractions at low and high pixel values.

If you omit the argument, TOL defaults to [0.01 0.99], saturating 2%.

If TOL = 0, LOW_HIGH = [min(I(:)); max(I(:))].

LOW_HIGH = stretchlim(RGB,TOL) returns a 2-by-3 matrix of intensity pairs to saturate each plane of the RGB image. TOL specifies the same fractions of saturation for each plane.

Class Support

The input image can be of class uint8, uint16, int16, double, or single. The output limits returned, LOW_HIGH, are of class double and have values between 0 and 1.

Example

See Also

brighten, histeq, imadjust


Previous page  strel subimage Next page

© 1994-2005 The MathWorks, Inc.