You are here : matlabImage Processingstretchlim

stretchlim() - Image Processing

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) 
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. where Tol specifies
the fraction of the image to saturate at low and high pixel values.Low_High = stretchlim(RGB,Tol) 
returns Low_High, a two-element vector of pixel
values that specify lower and upper limits that can be used for contrast
stretching truecolor image RGB. Low_High = stretchlim(gpuarrayI,___) performs
the operation on a GPU. . This syntax requires the Parallel Computing Toolbox™.Code Generation support:
Yes.MATLAB Function Block support:
Yes.


Syntax

Low_High = stretchlim(I) exampleLow_High = stretchlim(I,Tol)Low_High = stretchlim(RGB,Tol)Low_High = stretchlim(gpuarrayI,___)


Example

Find Limits to Stretch Contrast in Grayscale ImageOpen This Example
Read grayscale image into the workspace and display it.I = imread('pout.tif');
figure
imshow(I)

Adjust the contrast in the image using stretchlim to set the limits, and display the result. The example uses the default limits [0.01 0.99], saturating the upper 1% and the lower 1%.J = imadjust(I,stretchlim(I),[]);
figure
imshow(J)

Find Limits to Stretch Contrast in Grayscale Image on a GPURead grayscale image, creating a gpuArray. gpuarrayI = gpuArray(imread('pout.tif'));
figure, imshow(gpuarrayI)Adjust the contrast in the image using stretchlim to
set the limits. Display the result.gpuarrayJ = imadjust(gpuarrayI,stretchlim(I),[]);
figure, imshow(gpuarrayJ)


Output / Return Value


Limitations


Alternatives / See Also


Reference