Geoscience Reference
In-Depth Information
values using
lh = stretchlim(I1)
which yields
lh =
0.3255 0.2627 0.2784
0.7020 0.7216 0.7020
indicating that the red color ranges from 0.3255 to 0.7020, green ranges from
0.2627 to 0.7216, and blue ranges from 0.2784 to 0.7020. We can utilize this
information to automatically adjust the image with
imadjust
by typing
I2 = imadjust(I1,lh,[]);
which adjusts the ranges to the full range of [0,1], and then display the result.
imshow(I2)
We can clearly see the dif erence between the very pale image
I1
and the more
saturated image
I2
. h e parameter
gamma
in
imadjust(I1,[li;hi],[lo;ho],
gamma)
specii es the shape of the curve describing the relationship between
I1
and
I2
. If
gamma<1
the mapping is weighted toward higher (brighter) output
values. If
gamma>1
the mapping is weighted toward lower (darker) output
values. h e default value of
gamma=1
causes linear mapping of the values in
I1
to new values in
I2
.
I3 = imadjust(I1,lh,[],0.5);
I4 = imadjust(I1,lh,[],1.5);
subplot(2,2,1), imshow(I1), title('Original Image')
subplot(2,2,2), imshow(I2), title('Adjusted Image, Gamma=1.0')
subplot(2,2,3), imshow(I3), title('Adjusted Image, Gamma=0.5')
subplot(2,2,4), imshow(I4), title('Adjusted Image, Gamma=1.5')
We can use
imhist
to display a histogram showing the distribution of intensity
values for the image. Since
imhist
only works for two-dimensional images,
we examine the histogram of the red color only.
subplot(2,2,1), imhist(I1(:,:,1)), title('Original Image')
subplot(2,2,2), imhist(I2(:,:,1)), title('Adjusted Image, Gamma=1.0')
subplot(2,2,3), imhist(I3(:,:,1)), title('Adjusted Image, Gamma=0.5')
subplot(2,2,4), imhist(I4(:,:,1)), title('Adjusted Image, Gamma=1.5')
h e result obtained using
imadjust
dif ers from that obtained using
histeq
(which we used in Section 8.3 to enhance the contrast in the image). h e
function
histeq(I1,n)
transforms the intensity of image
I1
, returning in