Geoscience Reference
In-Depth Information
I2 = rgb2gray(I1);
imshow(I2,'XData',[0 ix],'YData',[0 iy]), axis on
xlabel('Centimeters'), ylabel('Centimeters')
title('Grayscale')
Since the image contrast is relatively low, we use the function
imadjust
to
adjust the image intensity values. h e function
imadjust
maps the values
in the intensity image
I1
to new values in
I2
, such that 1% of the data is
saturated at low and high intensities of
I2
. h is increases the contrast in the
new image
I2
.
I3 = imadjust(I2);
imshow(I3,'XData',[0 ix],'YData',[0 iy]), axis on
xlabel('Centimeters'), ylabel('Centimeters')
title('Better Contrast')
We next determine the background of the lithic grains, which basically
means the texture of the black foil on which the grains are located. h e
function
imopen(im,se)
determines objects in an image
im
below a certain
pixel size and a l at structuring element
se
, such as a disk with a radius of 5
pixels generated by the function
strel
. h e variable
I4
is the background-
free image resulting from this operation.
I4 = imopen(I3,strel('disk',5));
imshow(I4,'XData',[0 ix],'YData',[0 iy]), axis on
xlabel('Centimeters'), ylabel('Centimeters')
title('W/O Background')
We subtract the background-free image
I4
from the original grayscale image
I3
to observe the background
I5
that has been eliminated.
I5 = imsubtract(I3,I4);
imshow(I5,'XData',[0 ix],'YData',[0 iy]), axis on
xlabel('Centimeters'), ylabel('Centimeters')
title('Background')
h e function
im2bw
converts the
I4
image to a binary image (
I6
) by
thresholding. If the threshold is 1.0 the image is all black, corresponding to
a pixel value of 0. If the threshold is 0.0 the image is all white, corresponding
to a pixel value of 1. We manually change the threshold value until we get a
reasonable result. In our example a threshold of 0.03 gives good results for
identifying charcoal fragments.
I6 = im2bw(I4,0.03);
imshow(I6,'XData',[0 ix],'YData',[0 iy]), axis on
xlabel('Centimeters'), ylabel('Centimeters')
title('Only Charcoal')