Professional Documents
Culture Documents
Printed Circuit Board, Reverse Engineering Morphological operations used in the process of
Morphological Operation, Image segmentation, segmenting images. Image segmentation refers to the
Dilation, Erosion process of finding regions in an image that represent
objects or meaningful parts of objects. Common
1.0 INTRODUCTION applications of morphological operators include filling
small holes in objects, separating adjacent or slightly
overlapping objects, and joining broken boundaries into
Image segmentation is an important yet difficult
continuous segments.
computer vision task, as it requires to some extent a
semantic understanding of the image. Generally, it is the
Dilation and erosion are two fundamental
process of partitioning the image into disjoint regions,
morphological operations. Dilation adds pixel to the
each one being homogeneous and connected with boundaries in an image, while erosion removes pixels
respect to some property, such as gray-value, color,
on object boundaries. The rule used to determine
texture, motion. It can be divided into three different but
whether the pixels should be operated using dilation or
complementary stages, for example 1) preprocessing; 2) erosion (Xu, Gu & Peters, 2005)
region/feature extraction; and 3) segmentation algorithm
application, each one being significant for the final
I. Dilation The value of the output is the
segmentation result. maximum value of all the pixels in the input
pixels neighborhood. In a binary image, if any
This paper aims to obtain segmented PCB image using
of the pixels is set to the value 1, the output
morphology operation. Morphology relates to the pixel is set to 1 as illustrated in Fig. 1.
structure or form of objects. Morphological filtering
simplifies a segmented image to facilitate the search for
objects of interest. This is done by smoothing out object
outlines, filling small holes and eliminating small
projections. The two principal morphological operations
529
Table 1: Types of flat structuring element in Matlab
1 1 1
Flat structuring element
1 0 0 0 0 1 1 Arbitrary Pair
0 1 0 0 0 1 Diamond Periodicline
Disk Rectangle
0 0 1 0 0 0
Line Square
0 0 0 1 0 0 Octagon
0 0 0 0 1 0
I. Arbitrary
Input Image Output Image
SE = strel ('arbitrary',NHOOD) (2)
Fig 1: Morphological Dilation of a Binary Image
SE = strel (NHOOD) (3)
II. Erosion The value of the output pixel is the
minimum value of all the pixels in the input
Syntax above creates a flat structuring element where
pixels neighborhood. In a binary image, if any
NHOOD specifies the neighborhood. NHOOD is a
of the pixels is set to 0, the output pixel is set 0.
matrix containing 1's and 0's; the location of the 1's
defines the neighborhood for the morphological
2.1 Structuring Element in Morphology
operation. The center (or origin) of NHOOD is its center
Operation
element, given by floor ((size(NHOOD)+1)/2).
An essential part of the dilation and erosion operations
is the structuring element which is used to probe the
input image. The number of pixels added or removed
from the object in an image depends on the size and
shape of the structuring element. A structuring element
is a matrix consisting of only 0s and 1s that can have
any arbitrary shape and size. The pixels with values of 1
define the neighborhood (Boomgaard & Balen, 1992).
Fig.2: Arbitrary structuring element
Two-dimensional or flat structuring elements are
typically much smaller than the image being processed.
II. Diamond
The center pixel of the structuring element, called the
origin, identifies the pixel of interest or the pixel being
processed (Rolf, 1993). The pixels in the structuring SE = strel('diamond',R) (4)
element containing 1s define the neighborhood of the
structuring element. These pixels are also considered in Syntax (4) creates a flat, diamond-shaped structuring
dilation or erosion processing. There is another kind of element, where R specifies the distance from the
structuring element origin to the points of the diamond
structuring element, called three-dimensional or nonflat.
It uses 0s and 1s to classify the extent of the as shown in Fig. 3. R must be a nonnegative integer
structuring element in the x- and y- planes and add scalar.
height values to the third dimension. This research
adopts the two-dimensional structuring elements.
530
Syntax (5) creates a flat, disk-shaped structuring
element, where R specifies the radius. R must be a
nonnegative integer. N must be 0, 4, 6, or 8.
III. Pair
IV. Periodicline
SE = strel('periodicline',P,V) (9)
SE = strel('octagon',R) (7)
V. Rectangle
SE = strel('rectangle',MN) (10)
531
Syntax (10) creates a flat, rectangle-shaped structuring 3.2 Edge Detection
element, where MN specifies the size. MN must be a
two-element vector of nonnegative integers. The first The object to be segmented differs greatly in contrast
element of MN is the number of rows in the structuring from the background image. Changes in contrast can be
element neighborhood; the second element is the detected by operators that calculate the gradient of an
number of columns. image. The gradient image can be calculated and a
threshold can be applied to create a binary mask
containing the segmented tracks. First, edge detection is
used to calculate the threshold value, then tune the
threshold value and use edge again to obtain a binary
mask that contains the segmented tracks as shown in
Fig. 12.
VI. Square
SE = strel('square',W) (11)
3.3 Dilation
532
3.4 Fill Holes
4.0 CONCLUSION
533