[go: up one dir, main page]

0% found this document useful (0 votes)
114 views3 pages

Dilation Erotion Using Matlab

Erosion reduces the size of binary objects by removing pixels on the boundaries, while dilation increases size by growing objects. One application is joining breaks in contours using dilation. Another is identifying chips on a circuit board by eroding horizontal and vertical lines then dilating to restore chip size. Choosing an appropriate structuring element shape is crucial depending on the application and features to identify, enhance or remove.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
114 views3 pages

Dilation Erotion Using Matlab

Erosion reduces the size of binary objects by removing pixels on the boundaries, while dilation increases size by growing objects. One application is joining breaks in contours using dilation. Another is identifying chips on a circuit board by eroding horizontal and vertical lines then dilating to restore chip size. Choosing an appropriate structuring element shape is crucial depending on the application and features to identify, enhance or remove.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Effects and Uses of Erosion and Dilation

It is apparent that erosion reduces the size of a binary object, whereas dilation increases
it. Erosion has the effect of removing small isolated features, of breaking apart thin, joining
regions in a feature and of reducing the size of solid objects by ‘eroding’ them at the boundaries.
Dilation has an approximately reverse effect, broadening and thickening narrow regions and
growing the feature around its edges. Dilation and erosion are the reverse of each other, although
they are not inversing in the strict mathematical sense. This is because we cannot restore by
dilation an object which has previously been completely removed by erosion. Whether it is
dilation or erosion (or both) that is of interest, we stress that the appropriate choice of structuring
element is often crucial and will depend strongly on the application. In particular, we generally
seek to contrive structuring elements which are sensitive to specific shapes or structures and,
therefore, identify, enhance or delete them.
Effects and Uses of Erotion and Dilation

Figure 1. Illustrating a simple use of dilation to join small breaks in a defining contour

One of the simplest applications of dilation is to join together broken lines which form a
contour delineating a region of interest. For example, the effects of noise, uneven illumination
and other uncontrollable effects often limit the effectiveness of basic segmentation techniques
(e.g. edge detection). In our chosen example, taken from the field of space debris studies, a 3-D
depth map of an impact crater caused by a high-velocity, micro-sized aluminum particle has been
obtained with a scanning electron microscope. This is displayed at the top left in Figure 1. The
binary image (top right in Figure 1) resulting from edge detection using a Sobel kernel is
reasonably good, but there are a number of breaks in the contour defining the impact region. In
this particular example, the aim was to define the impact region of such craters automatically in
order to express the 3-D depth map as an expansion over a chosen set of 2-D orthogonal
functions. We can achieve this task in three simple steps.
 Dilate the edge map until the contour is closed.
 Fill in the background pixels enclosed by the contour. This is achieved by a
related morphological method called region filling.
 Erode the image (the same number of times as we originally dilated) to
maintain the overall size of the delineated region.

Our second example is illustrated in Figure 2 and demonstrates the importance of


choosing an appropriate structuring element for the given task at hand. Figure 2a depicts the
layout of a printed circuit in which there are two types of object: the rectangular chips and the
horizontal and vertical conduction tracks. The aim is to identify (i.e. segment) the chips
automatically. The microprocessor chips and the tracks are darker than the background and can
be identified reasonably well by simple intensity thresholding (see Figure 2b). The thin vertical
tracks can first be removed by eroding with a suitable long horizontal structuring element. As is
evident (see Figure 2c), the horizontal structuring element used here (a 3 x 18 array of 1s) tends
to preserve horizontal lines but remove thin vertical ones. Analogously, we can remove
horizontal lines (see Figure 2d) using an appropriate vertical structuring element (an 18 x 3 array
of 1s). These two erosions tend to remove most of the thin horizontal and vertical lines. They
leave intact the rectangular chips but have significantly reduced their size. We can remedy this
by now dilating twice with the same structuring elements (Figure 2e). The boundaries of the
structures identified in this way are finally superimposed on the original image for comparison
(Figure 2f). The result is quite good considering the simplicity of the approach (note the chip in
the center was not located properly due to poor segmentation from thresholding).
Code with explanation step-by-step
>>length = 18; tlevel = 0.2; %Define SE and percent threshold level
>>A = imread('circuit.tif'); subplot(2,3,1), imshow(A) %Read image and display
>>B = im2bw(A,tlevel); subplot(2,3,2), imshow(~B); %Threshold image and display
>>SE = ones(3,length); bw1 = imerode(~B,SE); %Erode vertical lines
>>subplot(2,3,3), imshow(bw1); %Display result
>>bw2 = imerode(bw1,SE'); subplot(2,3,4), imshow(bw2); %Erode horizontal lines
>>bw3 = imdilate(bw2,SE');bw4 = imdilate(bw3,SE); %Dilate back
>>subplot(2,3,5), imshow(bw4); %Display
>>boundary = bwperim(bw4);[i,j] = find(boundary); %Superimpose boundaries
>> subplot(2,3,6), imshow(A); hold on; plot(j,i,'r.');
This function produces a binary image consisting of the boundary pixels in the input
binary image.

Morphological Processing

Figure 2. Using dilation and erosion to identify features based on shape: (a) original; (b) result
after thresholding; (c) After erosion with horizontal line. (d) after erosion with vertical line; (e)
after dilation with same vertical and horizontal lines; (f) boundary of remaining objects
superimposed on original

You might also like