imshow will let you specify high and low when you view the image. Syntax here:
If you would like to convert a matrix to a grayscale image, you can use the following.
I = mat2gray(A, [amin amax])
If you want to determine an appropriate range of that grayscale image, one of the following may be used.
- contrast will create a new gray colormap, cmap, that has an approximately equal intensity distribution. See code below.
load clown;
cmap = contrast(X);
image(X);
colormap(cmap);
- stretchlim will find the limits to adjust (stretch) your contrast. Then you can use imadjust to adjust your image. See code below.
I = imread('pout.tif');
J = imadjust(I,stretchlim(I),[]);
imshow(I), figure, imshow(J)
- histeq will enhance contrast using histogram equalization. See code below.
I = imread('tire.tif');
J = histeq(I);
imshow(I)
figure, imshow(J)