Sie sind auf Seite 1von 5

Morphological Operation on Printed Circuit Board (PCB) Reverse

Engineering using MATLAB

Ruzinoor Che Mata Shahrul Azmib, Ruslizam Daudc


Abdul Nasir Zulkiflid and Farzana Kabir Ahmade
Fakulti of Technology Management
Universiti Utara Malaysia
06010 Sintok, Kedah Darulaman. Malaysia.
a
ruzinoor@uum.edu.my, bshahrulazmi@uum.edu.my, c ruslizam@uum.edu.my,
d
nasirzul@uum.edu.my, e farzana58@uum.edu.my

ABSTRACT are dilation and erosion will be employed in segmenting


PCBs image. The image which is used already
Image segmentation has been an important and processed in preprocessing stage and described in
challenging issue in the field of computer vision over previous paper, Reverse Engineering for Obsolete
decades. It plays a critical role for most image analysis Single Layer Printed Circuit Board (PCB) before
tasks, such as object detection and recognition. The aim applying morphological technique.
of this paper is to obtain segmented image of Printed
Circuit Board (PCB)s track using mathematical In the following section, a brief introduction on
morphological operation. Morphological image mathematical morphology operation will be discussed.
analysis is based on the idea that images represent a In section 3 the methodology that has been employed
collection of spatial patterns that can be analyzed based will be describes. It will include the phases involved in
on some predefined patterns called structuring segmenting the PCBs track. Finally, conclusions and
elements. Most basic morphological operation, dilation possible extension of the algorithm are discussed in
and erosion have been employed in this research. Detail section 4.
elaboration on this method will be discussed and
experimental results are presented. 2.0 MATHEMATICAL MORPHOLOGY
OPERATION
Keywords

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.

MatLab which is software meant for high performance


language in technical computing is used as a tool for
segmentation. Strel is a function in MatLab that create
morphology structuring element. Following is the
syntax for structuring element, SE:

SE = strel (shape,parameters) (1)


Fig.3: Diamond structuring element
Where shape is a string specifying the desired shape and
III. Disk
parameters is a list of factors that identify information
about the shape, such as its size. This table lists all the
SE = strel('disk',R,N) (5)
supported shapes. Depending on shape, strel can take
additional parameters. Next are the descriptions of
creating each type of structuring element (Jones &
Soille, 1996; The MathWorks , 2004).

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.

Fig.6: Octagon structuring element

III. Pair

Fig.4: Disk structuring element SE = strel('pair',OFFSET) (8)

I. Linear Syntax (8) creates a flat structuring element containing


two members. One member is located at the origin. The
SE = strel('line',LEN,DEG) (6) second member's location is specified by the vector
OFFSET. OFFSET must be a two-element vector of
Syntax (6) creates a flat, linear structuring element, integers.
where LEN specifies the length, and DEG specifies the
angle (in degrees) of the line, as measured in a
counterclockwise direction from the horizontal axis.
LEN is approximately the distance between the centers
of the structuring element members at opposite ends of
the line.

Fig.7: Pair structuring element

IV. Periodicline

SE = strel('periodicline',P,V) (9)

Syntax (9) creates a flat structuring element containing


2*P+1 members. V is a two-element vector containing
integer-valued row and column offsets. One structuring
element member is located at the origin. The other
Fig.5: Line structuring element members are located at 1*V, -1*V, 2*V, -2*V, .., P*V, -
P*V.
II. Octagon

SE = strel('octagon',R) (7)

Syntax (7) creates a flat, octagonal structuring element,


where R specifies the distance from the structuring
element origin to the sides of the octagon, as measured
along the horizontal and vertical axes. R must be a
nonnegative multiple of 3.

Fig.8: Octagon structuring element

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.

Fig.9: Octagon structuring element

VI. Square

SE = strel('square',W) (11)

Syntax (11) creates a square structuring element whose


width is W pixels. W must be a nonnegative integer
scalar.

Fig. 12 Binary mask of PCBs tracks

3.3 Dilation

The binary gradient mask shows lines of high contrast in


Fig.10: Octagon structuring element the image. These lines do not quite delineate the outline
of the tracks. Compared to the original image, there are
3.0 MORPHOLOGY OPERATION ON PCB gaps in the lines surrounding the object in the gradient
USING MATLAB mask. These linear gaps disappeared if the Sobel image
is dilated using linear structuring elements, which
PCBs tracks can be detected using morphological created using the strel function. Fig. 13 shows dilated
technique in MatLab. There are several steps involved gradient mask using linear structuring element.
such as:

3.1 Read an Image

Image of raw PCB is read and converted from truecolor


or RGB to grayscale and then to binary image as shown
in Fig. 11. The image is necessary to be in binary form
to enable processing of morphology operation.

Fig. 13: Dilated gradient mask

Fig. 11: PCB Binary Image

532
3.4 Fill Holes

The dilated gradient mask shows the reasonably outline,


but there are still holes in the interior of the tracks. To
fill these holes the imfill function is used. Fig. 14 shows
image that operated with imfill function.

Fig. 16: Segmented PCB image

4.0 CONCLUSION

Morphology is a broad set of image processing


operation that process images based on shapes.
Morphological operation applies a structuring element
to an input image, creating an output image of the same
size. This research used linear structuring element as it
Fig. 14: PCB binary image with imfill function has the same size and shape of PCBs tracks. The aim is
this research is to segmenting the PCBs tracks for re -
3.5 Remove Connected Object in Borders fabrication stages in further process. Using dilation and
erosion function in morphological operation, a fine
The tracks have been successfully segmented, but it has segmented PCBs tracks image was achieved.
some defects. Objects that are connected to the border
of the image need to be removed using the REFERENCES
imclearborder function.
Boomgaard, V.D. & Balen, R.V. (1992), Methods for
Fast Morphological Image Transforms Using
Bitmapped Images. Computer Vision, Graphics,
and Image Processing: Graphical Models and
Image Processing, 54(3), 252-254.
Jones, R. & Soille, P. (1996). Periodic lines: Definition,
cascades, and application to granulometrie. Pattern
Recognition Letters, 17(10), 1057-1063.
Rolf, A. (1993). Radial Decomposition of Discs and
Spheres. Computer Vision, Graphics, and Image
Processing: Graphical Models and Image
Processing, 55( 5), 325-332.
The MathWorks, (2004). Image Processing Toolbox
Fig. 15: Cleared border PCB image For Use With MATLAB, Version 5. The
MathWorks, Inc
Xu, J., Gu, L., & Peters, T.M. (2005). A Novel Multi-
3.6 Erosion stage 3D Medical Image Segmentation:
Methodology and Validation. In proceeding of
Finally, in order to make the segmented object look 2005 International Conference on Computational
natural, the tracks are smoothen by erode function with Intelligence and Security, Xian China.
a diamond structuring element.

533

Das könnte Ihnen auch gefallen