Geoscience Reference
In-Depth Information
objectsizes = sortrows(objectsizes,1);
objectsizes = objectsizes(objectsizes~=0);
We have now recognized 205 objects, i.e., more objects than were identii ed
in the previous exercise without watershed segmentation. Visual inspection
of the result, however, reveals some oversegmentation (due to noise or other
irregularities in the image) in which larger grains are divided into smaller
pieces. On the other hand, very small grains have been eliminated by i ltering
the image with the morphological structuring element strel . We scale the
object sizes. h e area of one pixel is (3 cm/367) 2 .
objectareas = 3^2 * objectsizes * 367^(-2);
We now determine the areas for each of the grains. We again i nd the
maximum, minimum and mean areas for all grains in the image, in cm 2 .
max_area = max(objectareas)
min_area = min(objectareas)
mean_area = mean(objectareas)
h e largest grain in the center of the image has a size of 0.09 cm 2 , which
represents the maximum size of all grains in the image. Finally, we plot the
histogram of all the grain areas.
clf
e = 0 : 0.0005 : 0.15;
histogram(objectareas,e)
xlabel('Grain Size in Millimeters^2'),...
ylabel('Number of Grains')
axis([0 0.1 0 70])
As a check of the i nal result we digitize the outline of one of the larger grains
and store the polygon in the variable data .
figure
imshow(I1,'XData',[0 ix],'YData',[0 iy])
data = ginput;
We close the polygon by copying the i rst row of coordinates to the end of the
array. We then display the polygon on the original image.
data(end+1,:) = data(1,:)
imshow(I1,'XData',[0 ix],'YData',[0 iy]), hold on
plot(data(:,1),data(:,2)), hold off
h e function polyarea yields the area of the large grain.
polyarea(data(:,1),data(:,2))
Search WWH ::




Custom Search