Full Text 01
Full Text 01
M ASTER T HESIS
Author:
Midhumol Augustian
2017
iii
Declaration of Authorship
I, Midhumol Augustian, declare that this thesis titled, “Neural network
based fault detection on painted surface ” and the work presented in it are
my own. I confirm that:
• This work was done wholly while in candidature for a Masters degree
in Robotics and control Engineering at Umeå University.
• Where I have consulted the published work of others, this is always
clearly attributed.
• Where I have quoted from the work of others, the source is always
given. With the exception of such quotations, this thesis is entirely my
own work.
• I have acknowledged all main sources of help.
• Where the thesis is based on work done by myself jointly with others,
I have made clear exactly what was done by others and what I have
contributed myself.
Signed:
Date:
v
Abstract
Machine vision systems combined with classification algorithms are being in-
creasingly used for different applications in the age of automation. One such
application would be the quality control of the painted automobile parts. The
fundamental elements of the machine vision system include camera, illumi-
nation, image acquisition software and computer vision algorithms. Tradi-
tional way of thinking puts too much importance on camera systems and ig-
nores other elements while designing a machine vision system. In this thesis
work, it is shown that selecting an appropriate illumination for illuminating
the surface being examined is equally important in case of machine vision
system for examining specular surface. Knowledge about the nature of the
surface, type and properties of the defect to be detected and classified are
important factors while choosing the illumination system for the machine
vision system. The main illumination system tested were bright field, dark
field and structured illumination and out of the three, dark field and struc-
tured illumination gave best results.
This thesis work proposes a dark field illumination based machine vision
system for fault detection on specular painted surface. A single layer Arti-
ficial Neural Network model is employed for the classification of defects in
intensity images of painted surface acquired with this machine vision sys-
tem. The results of this research work proved that the quality of the images
and size of data set used for training the Neural Network model play a vital
role in the performance of the classifier algorithm.
Keywords: Specular surface, Machine vision system, Automatic inspection,
Dark field illumination, Structured illumination, Artificial Neural Network
classifier.
vii
Acknowledgements
This thesis provided me with an exciting opportunity to learn and to acquire
a great deal of knowledge. I am extremely thankful to Volvo Group Trucks
Operations, Umeå and Mr. Kent Sundberg (Manager, Engineering Support
& IT at Volvo GTO, Umeå) for believing in my abilities and presenting me
with this wonderful opportunity.
I would like to extend my sincere gratitude to my supervisors Assoc. Prof.
Shafiq Ur Réhman, Dr. Muhammad Sikandar Lal Khan and Mr. Carl Marton
for their great guidance and mentorship.
I gratefully acknowledge my examiner Assoc. Prof. John Berge for his excel-
lent support during the thesis.
I take this opportunity to thank Ms. Yongcui Mi for being an inspiring team
mate. Her hard work and commitment always motivated me to strive to
achieve the goals of this thesis.
I would like to thank the employees at the mechanical workshop at Volvo
plant, Umeå for their excellent help with the mechanical setup of the machine
vision system.
Midhumol Augustian
Umeå, Sweden, 2017
ix
Contents
Abstract v
Acknowledgements vii
List of Figures xi
1 Introduction 1
1.1 Aim of the thesis . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Requirement specifications . . . . . . . . . . . . . . . . . . . . 2
1.3 Delimitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Thesis outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3 Methodology 15
3.1 Machine vision setup components . . . . . . . . . . . . . . . . 15
3.2 Computer vision methods for image enhancement . . . . . . . 17
3.2.1 Gabor filter . . . . . . . . . . . . . . . . . . . . . . . . . 17
3.2.2 Wavelet transform . . . . . . . . . . . . . . . . . . . . . 18
3.2.3 Super pixel segmentation . . . . . . . . . . . . . . . . . 19
3.3 Artificial neural network . . . . . . . . . . . . . . . . . . . . . . 20
3.4 Features for neural network . . . . . . . . . . . . . . . . . . . . 23
3.4.1 Histogram of Oriented Gradients (HOG) features . . . 23
3.4.2 Hu moments . . . . . . . . . . . . . . . . . . . . . . . . 25
x
4 Results 31
4.1 Image acquisition system . . . . . . . . . . . . . . . . . . . . . 31
4.1.1 Selection of camera . . . . . . . . . . . . . . . . . . . . . 32
4.1.2 Selection of optics . . . . . . . . . . . . . . . . . . . . . . 32
4.1.3 Selection of Illumination . . . . . . . . . . . . . . . . . . 33
Bright field illumination . . . . . . . . . . . . . . . . . . 33
Dark field illumination . . . . . . . . . . . . . . . . . . . 35
Structured illumination . . . . . . . . . . . . . . . . . . 37
4.2 Computer vision methods for defect enhancement . . . . . . 38
4.2.1 Morphological operations . . . . . . . . . . . . . . . . . 39
4.2.2 Gabor filter . . . . . . . . . . . . . . . . . . . . . . . . . 41
4.2.3 Wavelet transform . . . . . . . . . . . . . . . . . . . . . 43
4.2.4 Super pixel segmentation . . . . . . . . . . . . . . . . . 45
4.3 Defect classification based on Artificial Neural Network . . . . 46
4.3.1 Confusion matrix . . . . . . . . . . . . . . . . . . . . . . 48
4.3.2 Receiver Operating Curve for ANN model . . . . . . . 48
4.3.3 Defect detection with Artificial Neural Network . . . . 50
Bibliography 57
xi
List of Figures
3.1 Gabor filter with wavelength (λ) =10 and orientation (θ)=0. . . 18
3.2 2D wavelet decomposition. . . . . . . . . . . . . . . . . . . . . 19
3.3 Basic structure of single layer Artificial Neural Network. . . . 21
3.4 Illustration of Artificial Neural Network perceptron working. 22
3.5 Sigmoid function. . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6 Steps for calculation of HOG features. . . . . . . . . . . . . . . 23
3.7 Gradient image is divided in to non-overlapping HOG cells.
Each HOG cell consist of 4×4 pixels. . . . . . . . . . . . . . . . 24
3.8 Representation of HOG block. HOG block consist of 2×2 cells.
20×20 image contains 16 overlapping HOG blocks. . . . . . . 25
3.9 Visualization of HOG feature on dirt and scratch . . . . . . . 25
3.10 Block diagram representation of Artificial Neural Network train-
ing and testing phase. . . . . . . . . . . . . . . . . . . . . . . . . 27
3.11 Examples of data set used for ANN model generation. . . . . 28
3.12 Illustration of sliding window function utilized in testing phase
of ANN model. . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.1 Test matrix for used for the selection of setup. This test matrix
is mainly based on illuminations. . . . . . . . . . . . . . . . . . 33
4.2 Coaxial light setup for defect detection on painted surface. . . 34
4.3 Image with dirt captured under coaxial illumination. . . . . . 34
4.4 Ring light setup for defect detection on painted surface. . . . . 35
4.5 Images captured under ring light illumination. Defects are
marked inside the red boxes. . . . . . . . . . . . . . . . . . . . 36
4.6 Schematic representation of ring light setup used. . . . . . . . 36
4.7 Crater captured with ring light setup. . . . . . . . . . . . . . . 37
4.8 Deflectometry setup for defect detection on painted surface. . 38
4.9 Image captured with deflectometry setup. Defects marked in-
side red boxes are craters and yellow box is dirt. . . . . . . . . 38
4.10 Images used for processing. The defects are marked inside the
red boxes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.11 Morphological operation on dirt image. . . . . . . . . . . . . . 40
4.12 Morphological operation on scratch image. . . . . . . . . . . . 40
xii
List of Abbreviations
Chapter 1
Introduction
The over all aim of the thesis is to propose a vision based defect detection
solution for the paint fault inspection unit to make it more effective. The
thesis goals are listed below.
1. Study and investigate on feasible machine vision system for fault de-
tection on specular painted surface.
2. Evaluate the performance of sensors, optics and illumination on test
slab surfaces and propose a machine vision system for fault detection
on specular painted surfaces.
3. Employ machine learning algorithms for the classification of defects on
intensity images of test slabs captured with proposed machine vision
system.
1.3 Delimitations
There for, the thesis work only considered two major defect types dirt
and crater.
Chapter 2
Automotive paint is applied as various coats one after another. These paint-
ing coats include e-coat, primer coat, base coat and clear coat [5]. Base coat
determines the color and visual appearance of vehicle surface. The main
color type available are solid, metallic and pearl. Presence of aluminium
chips gives a sparkling effect for metallic surface. Since 87.47% of painted
truck surface are solid surface, the images were mainly collected from the
solid surface for the fault detection.
Automotive painting is a continuous process and surface flaws can occur
during this process. This paint defects can badly affect the final surface ap-
pearance of the automobile. Some defects can be measurable and some of
them are not.
2.2. Painted surface defects 7
Major measurable defects found on painted truck surfaces are explained be-
low.
• Dirt
Dirt is caused by the presence of foreign particle in the paint. This for-
eign particle can be dust or fibers.
• Crater
Crater is appeared as a circular volcano with raised edge. The reason
for crater is the difference in surface tension caused by contaminants in
the paint.
• Surface scratch
Main reason for surface scratch is mechanical damage on the top coat.
• Drips/ Runs
Drip is appeared as uneven coating caused by accumulation of paint.
8 Chapter 2. Theory and background
There are non-measurable paint defects like color difference, over spray, dry
spray, polishing marks etc. are also present on the painted surface.
It is clear from the figure 2.3 that crater appears as a curvature defect. This
kind of defects are visible only in some angles which make it difficult to cap-
ture by a machine vision camera. Also speckles in metallic surface may be
confused with defect by the fault detection algorithms. Hence the selection of
machine vision system and computer vision algorithms are critical to ensure
the performance of painted surface inspection system. The following sec-
tions in this chapter gives an overview of various components of a machine
vision system and different computer vision techniques for specular surface
inspection.
For a painted surface inspection the machine vision system requires a qual-
ity image to detect the defects. In a generic view we can say that a machine
vision system should be able to produce high contrast between features of
interest (defects) and the intact surface. Machine vision system consists of
camera, lenses, illumination, software for image acquisition and sophisti-
cated computer vision algorithm for processing the images. Major machine
vision techniques for specular surface inspection are intensity imaging [6] and
phase shifting [7]. This distinction is based on the illumination used in ma-
chine vision system. The following subsections give an account on the key
components of machine vision system.
2.3.1 Camera
Ajay [8] in his work presented two scanning techniques to scan the surface :
one is line scanning and other one is area scanning. Line scanning cameras
utilizes linear array of photo-sensors and its images are one dimensional. In
order to cover a large area either line scan camera or object is required to
move. The main advantage of line scan camera is that it can provide high
resolution images. The disadvantage of this technique is that in order to cre-
ate a complete image of a surface it requires an external hardware to join all
these lines. Since the cost of line scan is high, currently an array of area scan
cameras are widely used in machine vision applications to cover a large area.
Area scan camera can provide two dimensional image in a single exposure.
The working priciple of camera is that the incoming light from object is con-
verted to electrical signal by the photo sensor. This sensors can either be CCD
(charge coupled device) or CMOS (complimentary metal oxide semiconduc-
tor). The produced electricity is proportional to intensity of the incoming
light [9]. CMOS sensors can have more on-chip functionality than its coun-
terpart CCD sensor[10]. In this work the selected cameras for testing are
2.3. Machine vision system 9
2.3.2 Illumination
They are comprised of diffused (full bright field), coaxial light (full bright
field), directional bright field (partial bright field) and directional dark field
illumination [13] .
Diffuse lighting can provide uniform illumination and can eliminate shad-
ows. But it will not be suitable for automobile industry, because of its sensi-
tivy to uneven surface geometry [7]. Also it requires close proximity to the
surface to be inspected for effective inspection. In directional bright field il-
lumination the angle of incident light to the surface normal is small and this
causes most of the light to fall on the camera sensor. Hence the surface will
appear brighter and defects will appear darker in the captured image. With
dark field illumination the angle of incident light to the surface is smaller
and this subsequently leads to reflection of light away from the non-defective
surface. The presence of defects cause the light to reflect towards the cam-
era. Hence the image will be predominantly dark for non-defective area and
brighter for defects with dark field illumination.
2.4. Computer vision techniques for fault detection on painted surfaces 11
Abouelela et al. [14] proposed an automatic defect inspection system for tex-
tile fabric which employs infrared dark field lighting as illumination. They
suggested that dark-field can be helpful in magnifying minute defects. In
1990 Piironen et al. [15] developed a automated visual inspection system
for specular rolled metal surfaces. In their system a condensing bright field
illuminators and CCD line scan camera were used as image acquisition sys-
tem. Partial bright field illumination and dark field illumination setups were
compared for the inspection of highly reflective rings by Ramamoorthy et al.
[16]. In their work, dark field illumination setup images gave more accurate
defect detection results than partial bright field illumination images.
The phase shifting methods like fringe projection and deflectometry employs
a structured light pattern [7]. These patterns are projected onto the surface
and then the displacement or distortion of pattern caused by slope varia-
tions of the surface is measured. Structured illumination is often used to
obtain height map of the surface and especially for 3D inspection tasks [17].
Kammel et al. [18] gave a clear distinction between fringe projection method
and deflectometry. In fringe projection, camera is focused on to the surface
where the pattern is projected. Where as in deflectometry camera observes
the reflection of the pattern displayed on the screen by the surface. Here
the inspected surface is also a part of the optical system. Perard et al. [19]
pointed out that unlike fringe projection method deflectometry is sensitive
to small variations of the surface which is essential for measuring curvature
defects like crater on the painted surface.
The next step in machine vision system is to apply defect detection algo-
rithms on captured images of the painted surface. According to Xie [20],
major defect detection algorithms for intensity images can be classified into
four categories:
12 Chapter 2. Theory and background
1. Statistical approaches
2. Structural approaches
3. Filter based approaches
4. Model based approaches.
Filter based approaches include Gabor filter, Wavelet transform and edge de-
tection filters like Sobel, Canny, Laplacian, Robert and Deriche [20] for gray
scale images. A Gabor function is a two-dimensional Gaussian modulated
2.5. Related work on paint fault inspection systems 13
sinusoidal plane wave with frequency and orientation. In 1991, Jain et al.
performed an unsupervised learning of texture classification with Gabor fil-
ters [28]. Gabor filter can be seen as a preprocessing stage in defect detection.
With Gabor filter it is possible to create a distinction between defects and
background. Then a simple thresholding is required to extract the defect re-
gion [25].
Wavelet transforms with mother wavelets like Haar, Mexican Hat, Morlet etc
are used to find the edges in the 2D images. Kamlesh et al. explained that
2D wavelet transform filter bank decompose a 2D image into approximation
coefficients, and detail coefficients in three orientations (vertical, horizontal,
and diagonal) [29]. The approximation coefficient contain low frequency
component of the image and detail coefficient contains the high frequency
component of the image. This provides us with different edges in the im-
ages and also can be used to denoise the image. Based on a 2-D Translation
Invariant RI-Spline Wavelet Transform, Ren et al. [30] developed a novel
automated defects detection system for metallic surfaces.
robots. The sensor array scan the whole surface of the body to detect the
defects and robots mark these detected defects areas. ABIS system is able to
perform identification of the car type that enters the sensor portal, 3D data
acquisition, detection, analysis, and classification of defects. But this system
is restricted to detect defects on diffusively reflective surface like sheet met-
als.
D SIGHT is a real-time surface inspection system patented by Diffracto Ltd
in Canada [35] to check defects on highly reflective surfaces (roughness less
than 0.05 µm). The main components of this system consist of a camera, il-
lumination, and a retro reflective screen. This system is capable of detecting
minor out-of-plane surface defects on large highly specular surfaces. The
efficiency of this system reduces with increasing roughness of the painted
surface. The roughness of the surface must be less than 0.13 µm in order to
make sure adequate performance of this system. Since the contrast of the de-
fect is highly influenced by the ambient light, this system requires shielding
while inspecting the surface.
The German sensor manufacturer Micro-Epsilon introduced reflectCONTROL
for the inspection of painted car body surface [36]. The principle of inspection
is based on deflectometry technique and this system is able to 3D reconstruct
defects. To accomplish the surface inspection of a car, reflectCONTROL uti-
lizes four robots working in parallel, each one of them equipped with a large
monitor and four cameras. This inspection system takes less than one second
for the inspection of a car. But its performance is affected by orange peel of
the painted surface and ambient light in the inspection area.
Since all above mentioned online inspection systems are very expensive and
are purely based on computer vision techniques, this thesis work investi-
gates and propose much cheaper painted surface quality inspection system
solution based on data driven approach.
15
Chapter 3
Methodology
This chapter discusses the methodology followed in this thesis. In section 3.1,
a description of machine vision components tested in this work is presented.
Theory of various computer vision techniques employed in this thesis is dis-
cussed in section 3.2. In section 3.3, a description of artificial neural network
classifier and its feature set are presented.
The sensors, optics, and Illuminations which were tested during the thesis
work are listed below.
1. Sensors
• Genie Nano M2450 monochrome camera: Genie Nano M2450 is
a 5.1 MP monochrome camera with an image resolution of 2448 ×
2048. It uses gigabit Ethernet as interface and data transfer is over
Ethernet cable. Each pixel has a size of 3.45 µm which is smaller
than the defect size. The image acquisition software supported by
Gene camera is Common vision blox licensed by Stemmer imaging
[37].
• Basler ace 2.3 MP monochrome camera: Basler ace is a monochrome
camera with a CMOS sensor. It has an image resolution of 1920 x
1200 and each pixel has a size of 5.86 µm. The data transfer is over
USB 3.0 and image acquisition software is Matrox Design Assis-
tant which is licensed by Matrox imaging [38].
2. Optics
• Telecentric lens: TC 23036 telecentric lens has a working distance
of 10.25 cm and a depth of field of 11 mm. Object should be kept in
depth field range to ensure a sharp image of the object. The object
field of view provided by TC23036 lens is equal to 6.1 cm. The
distortion of the real image is less than 0.04 % [39].
• Kowa lens (Conventional lens): Kowa LM16 is a C mount lens
with a manual focus control. The focal length of this lens is equal
16 Chapter 3. Methodology
where λ is the wavelength and ψ is the phase offset of the cosine function in
Gabor filter equation. σ represents standard deviation of the Gaussisan func-
tion in Gabor filter equation and γ is the aspect ratio of the Gaussian function.
θ represents orientation of the Gabor filter. The Gabor filter response of a 2-D
image can be obtained by convolution of image with a Gabor filter bank.
F IGURE 3.1: Gabor filter with wavelength (λ) =10 and orienta-
tion (θ)=0.
Wavelet transform can plot a signal in both frequency and time domain. A
pyramidal algorithm proposed by Mallat utilizes a low pass and high pass
filter banks for the decomposition of a 2D image [48] as demonstrated in
figure 3.2.
3.2. Computer vision methods for image enhancement 19
edge. For each pixel in the 2S×2S region around the center Ck , the distance
between center and pixel (Ds ) is calculated based on the formula 3.3.
p
dlab = (lk − li )2 + (ak − ai )2 + (bk − bi )2
p
dxy = (xk − xi )2 + (yk − yi )2 (3.3)
m
Ds = dlab + dxy
S
With larger m value, more weight is given to spatial proximity and with
smaller m value more weight is given to color similarity. After each pixel
is associated with a cluster, the cluster center is updated with the average of
the [l, a, b, x, y]T vector. This process is repeated until the error between new
cluster center and previous cluster center is less than a previously assigned
threshold value.
Input nodes are passive, they receive a single feature value and then feed it
to the multiple output layers or hidden layers. Output layers multiply these
input data with its corresponding weight and sum over all as described in
equation 3.6. Feed forward propagation is depicted in figure 3.4.
577
X
zj = xi wj,i (3.6)
i=1
The output of ANN is calculated by introducing equation 3.6 into the acti-
vation function. A common example of activation function is sigmoid func-
tion which is defined in formula 3.7. Sigmoid function is monotonically in-
creasing function which is constrained by horizontal asymptotes as the input
reaches ±∞ [54].
1
aj = (3.7)
1 + e−zj
Sigmoid function limits the real valued input in to a range between 0 and 1.
An example of sigmoid function is shown in figure 3.5.
22 Chapter 3. Methodology
Then the error for j th output node is calculated from the difference between
desired output of node j and current activation of node.
e j = y j − aj (3.8)
The first step for the computation of the HOG is to calculate the gradient
of the image. The gradient computation is performed by filtering the image
with horizontal and vertical derivative filter.
−1
x = −1 0 1 and y = 0 (3.11)
1
24 Chapter 3. Methodology
The HOG features are visualized with rose plots in MATLAB. The sixteen
rose plots correspond to sixteen HOG blocks and each petal length corre-
sponds to the gradient magnitude of each orientations. It is obvious from
figure 3.9 that HOG feature can give a clear distinction between dirt and
scratch image.
In the next subsection another feature set known as Hu moment tested for
the generation of ANN model is discussed.
3.4.2 Hu moments
Hu moments are generated for each patch of the image for ANN model learn-
ing. Prior to the calculation of Hu moments, it is required to calculate raw
moments and central moments. Raw image moment can be calculated as
26 Chapter 3. Methodology
follows:
XX
Mij = xi y j I(x, y), (3.13)
x y
where (x, y) is the image coordinate and I(x, y) is the corresponding intensity
of the image. XX
M00 = I(x, y)
x y
XX
M10 = xI(x, y) (3.14)
x y
XX
M01 = yI(x, y)
x y
M00 is the zero order moment and M01 and M10 are the first order moments.
M00 represents sum of grey level in an image. First order moments contain
information about the center of gravity of the object (x̄, ȳ).
M10 M01
x̄ = , ȳ = (3.15)
M00 M00
Central moment is dependent on the size of the object in an image. For ex-
ample, image of an object taken from different distance has different size.
In 1962 Hu proposed HU moments [56] for visual pattern recognition. Hu
momenta are rotational, scale, translational invariant. It is calculated from
first, second and third order central moments. The equation 3.17 shows the
calculation steps for Hu moments.
h1 = µ20 + µ02
h2 = (µ20 − µ02 )2 + 4µ211
h3 = (µ30 − 3µ12 )2 + (3µ21 − µ03 )2
h4 = (µ30 + µ12 )2 + (µ21 + µ03 )2
h5 = (µ30 − 3µ12 )(µ30 + µ12 )[(µ30 + µ12 )2 − 3(µ21 + µ03 )2 ] + (3µ21 − µ03 )
(µ21 + µ03 )[3(µ30 + µ12 )2 − (µ21 + µ03 )2 ]
h6 = (µ20 − µ02 )[(µ30 + µ12 )2 − (µ21 + µ03 )2 ] + 4µ11 (µ30 + µ12 )(µ21 + µ03 )
h7 = (3µ21 − µ03 )(µ30 + µ12 )[(µ30 + µ12 )2 − 3(µ21 + µ03 )2 ] − (µ30 − 3µ12 )
(µ21 + µ03 )[3(µ30 + µ12 )2 − (µ21 + µ03 )2 ]
h8 = µ11 [(µ30 + µ12 )2 − (µ03 + µ21 )2 ] − (µ20 − µ02 )(µ30 + µ12 )(µ30 + µ21 )
(3.17)
3.4. Features for neural network 27
The data set used in this work is collected from the test slabs gathered from
painting work shop. The data set consist of 300 images with an image size of
2448 x 2048 pixels each in .bmp format. The image set includes scratches, dirt
and no defect area. These images were captured with a monochrome camera
under ring light illumination. Examples from each data set are shown in
figure 3.11.
28 Chapter 3. Methodology
An approach to divide the data set for training and testing as suggested by
Weimer et al. [21] is adopted in this work. 70 % of data set is used for training
and 30% of data set is used for testing. The training data set consists of 500
image patches and testing data set consists of 150 image patches. Only im-
ages inside the circular reflection of ring light are extracted for training and
testing.
F IGURE 3.11: Examples of data set used for ANN model gener-
ation.
D
m= − 1, (3.18)
f
where f represents the focal length and D represents working distance and m
represents magnification. Calculations reveals that defect size of 0.3 mm has
a size of 0.057 mm in an image. With a camera sensor having one pixel size
equal to 3.45 µm this defect size is equivalent to 17 pixel in an image. The
image patch should be atleast 20×20 in order to include a defect of size 0.3
mm.
Training data is labeled text files. The labels were 1 for no defects 2 for dirt
and 3 for scratches. For the testing, images inside the circular reflection of
ring light with a size 500×500 pixels were cropped. Image patches of size
20×20 pixels were extracted from this cropped images in sliding window
fashion. Sliding window is performed in a way that, the image is divided
into overlapping windows of size 20×20 pixels with an overlap of 10 pixel
3.4. Features for neural network 29
Thamer et al [21] evaluated the performance of the ANN classifier using Re-
ceiver Operating Curve (ROC). Kevin et al [58] explained how to generate
a ROC curve for two class artificial neural network. Since our problem is a
multi-class problem (no defect, dirt, scratch), ROC for no defect class is plot-
ted by considering no defect as one class and dirt and scratch together as
defect class (no defect class vs defect class).
The x-axis of ROC is defined by false positive rate (FPR) and y-axis of ROC
curve is defined by true positive rate (TPR).True positive rate is the percent-
age of defect samples that are correctly detected as defect samples. Or it can
be defined as the ratio of true positives (TP) with respect to the total number
of actual defect images P, TPR=TP/P. True positive is the number of correctly
predicted defects. TPR is also known as sensitivity. The false positive rate
(FPR) gives the ratio of false positives with respect to the total number of
non-defect images N, FPR=FP/N. False positives (FP) are non-defect images
miss-classified as defective images. False positive rate is also known as fall
out.
ROC points are generated by varying the threshold value of output node
activation. Threshold value is chosen in a range between 0 and 1. The node
corresponding to the defect class is evaluated and if the value is greater than
the threshold, image is classifiedd as positive. An ideal ROC has an area
equal to one [21].
31
Chapter 4
Results
This chapter is structured as follows. Section 4.1 presents the results of var-
ious combinations of illuminations, camera and optics tested and final pro-
posal for the machine vision system for fault detection on painted surface.
Section 4.2 shows defect enhancement with various computer vision tech-
niques. This includes results of morphological operations, Gabor filter, wavelet
transform etc. The last section of this chapter presents classification of defect
based on Artificial Neural Network classifier.
The key steps in selection of machine vision system include selection of cam-
era which is able to capture target image and suitable optics for camera that
can focus on to the surface of the target. The final step is the selection of
appropriate illumination type that can increase the contrast between back
ground and defect. Even though this aspect is vital, often it is not paid the
attention it requires.
The final setup selection is based on the following criteria:
• Stability in performance irrespective of color,
• Stability in performance irrespective of color type category,
• Stability in performance irrespective of curved surface,
• Stability in performance irrespective of ambient light condition,
• High contrast between dirt and background surface,
• High contrast between crater and background surface.
Painted surface is available in different colors, hence the faults detection sta-
bility of machine vision system with various colors is a key factor. The base
coat in painting determines final appearance as solid, metallic and pearl type
color category. The sparkling effect of pearl and metallic surface with light-
ing cause speckles in the images of painted surface. This reduces the perfor-
mance of various defect detection algorithms and sometimes these speckles
32 Chapter 4. Results
The first step in selecting a machine vision camera is to find out the minimum
resolution required for the application. To obtain a better quality image it is
critical to choose an image sensor that can capture smallest feature according
to the application. Using the following formula, minimum resolution can be
found from the field of view and size of the smallest feature to inspect [59].
Field of view
Minimum resolution = 2 (4.1)
Smallest feature size
The calculations reveal that a typical defect of size 0.3 mm and a field of view
of 200 mm x 100 mm (size of test slab) would required a minimum sensor
resolution of 1333 x 666 pixels. A Basler ace 2.3 MP camera (1920 x 1200) or
Gene Nano M2450 5.1 MP (2448 x 2048) are appropriate for this requirements.
Since field of view of camera and sensor resolution is directly proportional,
to cover larger area higher resolution camera is required. Higher resolution
images complicate further processing of images. Other options to cover a
larger area are either move the object under inspection to the field of view of
the camera or use more cameras with overlapping field of view.
Gene nano M2450 has a sensor format of 2/3 ” which is equal to 8.8 mm sen-
sor size in diagonal. According to the equation 4.2 an application of working
distance 200 mm and field of view of 100 mm would required a lens of focal
length 16.17 mm. Kowa lens is appropriate for this requirement.
4.1. Image acquisition system 33
Another lens tested was telecentric lens. Even though telecentric lens can
provide same magnification for all objects and can eliminate perspective dis-
tortion, it is not suitable for this application. Because telecentic lens has a
field of view of 6 cm, working distance of 10 cm, telecentric depth of 1 .1 cm.
Image quality can ensure only in its telecentric depth. Beyond this telecentric
depth images are distorted.
F IGURE 4.1: Test matrix for used for the selection of setup. This
test matrix is mainly based on illuminations.
In images, generated with bright field illumination the defects are recognized
as darker than the background. The bright field illumination tested during
the experiment include diffused dome light and coaxial light. The images
captured under dome light have very poor contrast between defect and back-
ground. In addition, a round shape reflection pattern corresponds to the hole
34 Chapter 4. Results
in the dome is observed on the captured image due to the specular property
of the slab surface. Hence dome light is ineffective for this particular appli-
cation.
Figure 4.2 illustrates the working principle of coaxial light and photograph
of experimental setup. A half mirror in coaxial light reflects light on to the
target. The defect free region of target produces specular reflection and is al-
lowed to pass through the half mirror to the camera. The light is diffusely re-
flected by the defects and this diffuse reflection is not allowed to pass through
the half mirror. Image of a test slab captured with coaxial illumination is il-
lustrated in figure 4.3.
It can be observed that image is free of specular reflection. The image ob-
tained from coaxial light illumination is acceptable but not good enough for
further image processing. The defects are clearer near the shadow of coaxial
light. Coaxial light required a close proximity to the object under inspection
to make a contrast between defect and background which is not practical for
a painted truck body inspection system.
Dark field illumination types that were tested includes IR ring light, RGB
ring light and white ring light. The advantage of dark field illumination over
bright field illumination is that the features of interest are highlighted with
high contrast in image captured under dark field illumination. Thus com-
paratively less image processing effort is required for dark field illumination.
Dark field illumination principle is shown in figure 4.4. The low angle light
ray coming from ring light is reflected away from the specular target surface
and light hits on defects will be reflected towards the camera.
Hence the image captured mainly consists of dark regions in the absence of
defects. The defects are captured as bright regions with dark background.
Images captured with ring light is illustrated in figure 4.5. Since defects have
high contrast inside the ring light reflection region, this image patch is ex-
tracted for further processing. This region is around 6 cm diameter. Hence in
order to cover larger area, overlapping images should be append together.
36 Chapter 4. Results
White ring light provide better images than RGB ring light for different color
surfaces. Sometimes ambient light inside the experimental lab contributes
brightness variations on the images which will affect quality of the image. IR
ring light can eliminate this problem to a great extent.
Even though ring light setup can generate good enough images for solid sur-
faces, ring light could not avoid speckles in images of metallic painted sur-
face. Computer vision methods like super pixel segmentation is employed
to overcome this problem.
after numerous trial and error experiments is illustrated in figure 4.6. The
image is consistently free from the specular reflections if the lens tip is kept
inside the ring illumination.
Structured illumination
Ring light setup is good enough for capturing defects like dirt. However,
ring light setup was not effective for capturing crater (There is a crater inside
the black circle which is not visible on image 4.7a). When the crater defect
move towards a pattern like reflection of ring light, it can be visible on the
image as illustrated in figure 4.7b. This reveals the potential of structured
illumination for highlighting crater.
The images in figure 4.10 are used as the inputs for morphological operations,
Gabor filter, wavelet transform method and super pixel segmentation.
Dilation adds pixels to the boundaries of the image. The value of the output
pixel is the maximum value in the neighborhood of the input pixels. So the
defect is enlarged in images captured with dark field illumination.
A Gabor filter bank was created in MATLAB where the inputs to the fil-
ter bank are orientation of the filter (in degrees) and wavelength (in pix-
els/cycle). The output of the filter bank is Gabor array. The real part of Gabor
filter with different orientations (zero and ninety degrees) and wavelengths
(ten and fifteen pixels/cycle) are shown in figure 4.13.
F IGURE 4.13: Real part of the filter in the Gabor filter array.
The orientation parameter of the Gabor filter bank should be chosen so that
the alignment of the defects and Gabor filter are similar. This is evident from
figure 4.16 where the scratch could be detected easily when the orientation
is set as 45 degrees which is approximately equal to the orientation of the
scratch. The orientation parameter is vital for the detection of scratch where
as it is not so important for dirt.
Even though there are several types of wavelet transforms, Haar wavelet
transform method has been employed in this work. This method gave good
results compared to methods like db1, db2 etc, during the trial and error
phase.
44 Chapter 4. Results
As we can observe from the figures 4.19 and 4.20, the vertical coefficient high-
lights the defect region clearly whereas the approximation coefficient high-
lights even the minute details of the image which is not necessary for defect
detection.
When horizontal detail component is applied on deflectometry image with
vertical stripes, the vertical strips are avoided thereby highlighting just the
defects. Similarly vertical detail component would be suitable to be applied
on deflectometry image with horizontal stripes to obtain good results with
defect detection.
Even though all the above discussed methods were able to enhance the de-
fects from its background, a defect classification was not performed with
these methods. Hence machine learning algorithm was implemented in MAT-
LAB in order to classify the images into three classes viz. no defect, dirt and
scratch. The algorithm implemented is a single layer Artificial Neural Net-
work consisting iteration of back propagation and sigmoid activation func-
tion. HOG features and Hu moments were tested for the learning process of
the ANN model. However, the model built based on Hu moments did not
give good results in classifying the images. Model with Hu moments could
only achieve a predictive accuracy of less than 50%. The performance of the
ANN model with HOG features was analyzed in the training phase and the
model classified 92.1% of the images correctly. So HOG features of the images
were used as data set to train the Neural Network and to generate a model.
HOG feature vector size for a 20x20 image patch has a size of 1x576. Hence
the size of the weight matrix including the bias for an ANN with three output
nodes is 3x577. The learning rate for back propagation was chosen randomly.
The learning rate used to obtain the final model was 0.0369. The time taken
for training this model was found to be 59.256 minutes.
4.3. Defect classification based on Artificial Neural Network 47
The data set used for training the ANN model consisted of 500 images. Out of
the 500 images, 270 images were of no defect type, 104 images were of scratch
type and 126 images were of dirt type. During the test phase model classified
91.47 % of the images correctly. The data set for test phase consisted of 150
images. The performance of the machine learning algorithm is summarized
below.
• Predictive accuracy
Predictive accuracy describes how accurate the ANN model classifies
the test images. The predictive accuracy of the learned system was
found to be 91.47 % during testing phase.
• Complexity
Complexity is an analysis parameter which describes how simple the
trained model is. The trained model is a single layer ANN model and
its weights are a matrix of size 3x577. So it can be said that the model is
relatively simple.
• Efficiency
Efficiency describes the time needed for training. The time taken for
training this model with HOG feature set was found to be 59.256 min-
utes.
• Robustness
Robustness describes how well the trained model could classify the im-
ages that are noisy. In order to check the robustness, the image of the
metallic surface is tested with the sliding window function as shown in
figure 4.28. It is clear from the figure 4.28 that the robustness is bad as
the speckles are wrongly detected as dirt and scratch.
• Scalability
Scalability is the parameter which describes the performance of the sys-
tem depending on the size of the data. The ANN model was tested with
50, 100 and 150 feature set. The system took 0.56 s, 0.90 s and 1.24 s re-
spectively for the testing process. As it is evident from the time data,
the time required for testing increases with the size of the test data set.
• Interpretability
Interpretability describes how easily the output and operation of the
system are understandable to human. The system gives integer outputs
1, 2 or 3 based on the classification decision the model makes. The
model gives an output of 1 if the image is classified as no defect, 2 if the
image is classified as dirt and 3 if the image is classified as scratch. The
sliding window function in conjunction with the model could identify
the position of the defects in the image. The sliding window function
marks the area in the image with dirt in blue color and the area with
48 Chapter 4. Results
scratch in red color as illustrated in figures 4.26 and 4.27. Overall the
output of the system is quite easy to understand and interpret.
Confusion matrix was made to analyze the performance of the ANN model
as shown in the table below. The values of TP, FP, TN and FN are tabulated
in the confusion matrix.
Prediction
Positive Negative
Positive T P = 107 F N = 6
Actual
Negative FP = 0 T N = 39
The confusion matrix was calculated for a classification algorithm which clas-
sifies images into two classes viz: no defect class and defect class. This confu-
sion matrix shows excellent performance of the ANN model with no images
without any defects are classified as defective. Mean while only six non de-
fective images are classified as defective.
ROC plots are plotted to visualize the performance of the system in classifi-
cation of the images. ROCs are plotted for no defect detection, dirt detection
and scratch detection. The ROCs for the three different classes are shown in
figure 4.23, 4.24 and 4.25.
4.3. Defect classification based on Artificial Neural Network 49
The defect detection system is doing a good job when it does not miss a de-
fect. The system should detect a defect even if many non defect images are
classified as defect images. This implies that the true positive rate should be
close to one for the entire ROC plot. From the figure it is clear that ANN
model is good, as the area under the curve is close to the maximum value for
all the three classes.
The data set for training the ANN system consists of image patches which
are of size 20x20. The image size was selected to be 20x20 in order to keep
the size of the feature set at an optimal level so that the training of the system
could be achieved in an acceptable time duration. This is advantageous for
the ANN model to learn about small sized defects which otherwise may have
a chance of being not detected in a big sized image. So in order to detect the
defects in a bigger image (500x500) which is cropped inside the reflection
of ring light, a sliding window function was implemented. Sliding window
function scans through the entire image taking a part of the image with size
of 20x20 at a time.Then the HOG feature set of the selected window is fed to
the ANN model for classification. Windows classified as dirt is highlighted
in blue color and the windows classified as scratch is highlighted in red color.
The results obtained when the sliding window function is applied on images
are shown in figure 4.26 and 4.27.
4.3. Defect classification based on Artificial Neural Network 51
From the figures 4.26 and 4.27 it can be observed that at the corners of the
defects are classified incorrectly. This may be due to the fact that when the
windows at the corners are taken for classification by sliding window func-
tion, the size of the defect might have not been good enough in the window
for right classification.
In order to test the robustness of the ANN model, a metallic surface image
was input to the sliding window function instead of the solid surface image.
The result of the sliding window function on the metallic surface image is
shown in figure 4.28.
52 Chapter 4. Results
The figure 4.28 clearly shows that the robustness of the ANN model is very
poor on metallic surface. Sparkles on the metallic surface is wrongly classi-
fied as dirt and scratches.
53
Chapter 5
ANN model trained with HOG features of images as data set could give a
clear distinction between dirt, scratch and no defect classes.
The quality of the images was found to be a very important factor influenc-
ing the correct classification of the images. Images with darker background
and brighter defects gave excellent results with classification compared to
brighter images. The higher the contrast between the background and the de-
fects in the images, the better are the classification results. The image should
only highlight the defects and rest of the surface should be darker and uni-
form in order to ensure high prediction accuracy. This indicates that image
quality and illumination system are determining defect detection accuracy
of a machine vision system for specular surface. However, the ANN model
could not classify the images of metallic surfaces with speckles in a reliable
manner as the speckles were misunderstood as dirt and scratch. The factors
influencing the robustness of the algorithm should be investigated and they
should be improved before employing the ANN model for classification of
images that are noisy.
The size of the data set is an another factor affecting the performance of the
machine learning algorithm. It was a time consuming process to capture lot
of images and crop these images manually. Efficient and faster method to
create a large data set could be something that should be developed.
The performance of the ANN model in classification of the images should
be compared with that of other models based classifier algorithms like SVM
classifier in future. This would help in establishing which algorithm gives
better results with detection and classification of defects.
55
Appendix A
During defect detection with ANN model, some parts of no defect region is
miss-classified as defect regions. This is due to the fact that images in A.1 and
A.2 have brighter background and contrast between defect and background
is not that good. The background has poor quality due to non uniform il-
lumination. This indicates the importance of image quality to ensure good
detection result with ANN model.
57
Bibliography
[14] Ahmed Abouelela et al. “Automated vision system for localizing struc-
tural defects in textile fabrics”. In: Pattern recognition letters 26.10 (2005),
pp. 1435–1443.
[15] Timo Piironen et al. “Automated visual inspection of rolled metal sur-
faces”. In: Machine Vision and Applications 3.4 (1990), pp. 247–254.
[16] Riby Abraham Boby et al. “Identification of defects on highly reflec-
tive ring components and analysis using machine vision”. In: The In-
ternational Journal of Advanced Manufacturing Technology 52.1-4 (2011),
pp. 217–233.
[17] Markus C Knauer, Jurgen Kaminski, and Gerd Hausler. “Phase mea-
suring deflectometry: a new approach to measure specular free- form
surfaces”. In: Proceedings of SPIE 5457.0 (2004), pp. 366–376.
[18] Sören Kammel and Fernando Puente León. “Deflectometric measure-
ment of specular surfaces”. In: IEEE transactions on instrumentation and
measurement 57.4 (2008), pp. 763–769.
[19] Denis Perard and Juergen Beyerer. “Three-dimensional measurement
of specular free-form surfaces with a structured-lighting reflection
technique”. In: Intelligent Systems & Advanced Manufacturing (1997),
pp. 74–80.
[20] Xianghua Xie. “A review of recent advances in surface defect detec-
tion using texture analysis techniques”. In: ELCVIA Electronic Letters on
Computer Vision and Image Analysis 7.3 (2008).
[21] D Weimer, H Thamer, and B Scholz-Reiter. “Learning defect classifiers
for textured surfaces using neural networks and statistical feature rep-
resentations”. In: Procedia CIRP 7 (2013), pp. 347–352.
[22] Zhihu Huang and Jinsong Leng. “Analysis of Hu’s moment invariants
on image scaling and rotation”. In: Computer Engineering and Technology
(ICCET), 2010 2nd International Conference on 7 (2010), pp. V7–476.
[23] F Tajeripour and E Kabir. “Defect detection in patterned fabrics using
modified local binary patterns”. In: Conference on Computational Intel-
ligence and Multimedia Applications, 2007. International Conference on 2
(2007), pp. 261–267.
[24] Navneet Dalal and Bill Triggs. “Histograms of oriented gradients for
human detection”. In: Computer Vision and Pattern Recognition, 2005.
CVPR 2005. IEEE Computer Society Conference on 1 (2005), pp. 886–893.
[25] Mohammad H Karimi and Davud Asemani. “Surface defect detection
in tiling Industries using digital image processing methods: Analysis
and evaluation”. In: ISA transactions 53.3 (2014), pp. 834–844.
[26] Kai-Ling Mak, P Peng, and KFC Yiu. “Fabric defect detection using
morphological filters”. In: Image and Vision Computing 27.10 (2009),
pp. 1585–1592.
[27] H Elbehiery, A Hefnawy, and M Elewa. “Surface Defects Detection
for Ceramic Tiles Using Image Processing and Morphological Tech-
niques.” In: WEC (5) (2005), pp. 158–162.
[28] Anil K Jain and Farshid Farrokhnia. “Unsupervised texture segmenta-
tion using Gabor filters”. In: Pattern recognition 24.12 (1991), pp. 1167–
1186.
BIBLIOGRAPHY 59
[29] Kamlesh Kumar et al. “Image edge detection scheme using wavelet
transform”. In: 11th International Computer Conference on Wavelet Active
Media Technology and Information Processing (2014), pp. 261–265.
[30] Shiqing Ren et al. “Inspection of Smooth Metallic Surface Using Com-
plex Discrete Wavelet Transform”. In: 3rd International Conference on In-
novative Computing Information and Control (2008), pp. 63–63.
[31] Kamil Zidek et al. “Embedded vision equipment of industrial robot
for inline detection of product errors by clustering–classification al-
gorithms”. In: International Journal of Advanced Robotic Systems 13(5)
(2016), p. 1729881416664901.
[32] AG Ramakrishnan, S Kumar Raja, and HV Raghu Ram. “Neural
network-based segmentation of textures using Gabor features”. In: 12th
IEEE Workshop on Neural Networks for Signal Processing (2002), pp. 365–
374.
[33] Ajay Kumar. “Neural network based detection of local textile defects”.
In: Pattern Recognition 36(7) (2003), pp. 1645–1659.
[34] Stefan Karbacher et al. “Visualization and detection of small defects
on car-bodies”. In: Modeling and Visualization , Sankt Augustin (1999),
pp. 1–8.
[35] Rodger L Reynolds et al. “Theory and applications of a surface inspec-
tion technique using double-pass retroreflection”. In: Optical Engineer-
ing 32.9 (1993), pp. 2122–2129.
[36] H. Loferer. “Automatic Painted Surface Inspection and Defect Detec-
tion”. In: Proceedings SENSOR 2011 (2001), pp. 871–873.
[37] Genie Nano C4030 Color - Product Detail - Teledyne DALSA. http :
/ / www . teledynedalsa . com / imaging / products / cameras /
area- scan/genie- nano/G3- GM10- M2450/. Accessed: 2017-08-
03.
[38] Basler Microscopy ace 2.3 MP, 1/1.2 in. format, C-Mount, 1920 x 1200.
https://graftek.biz/products/basler-microscopy-ace-
2-dot-3-mp-1-slash-1-dot-2-in-format-c-mount-1920-
x-1200-82-fps-color. Accessed: 2017-08-03.
[39] TC23036 - Opto Engineering. https://www.stemmer-imaging.se/
media/uploads/optics/opto- engineering/en/en- Opto-
Engineering - TC - 23036 - Bi - Telecentric - Lens - OOPEN23 -
201503.pdf. Accessed: 2017-08-03.
[40] Kowa LM16JC10M 2/3" 16mm F1.8 Manual Iris C-Mount Lens, 10-
Megapixel Rated. http : / / www . rmaelectronics . com / kowa -
lm16jc10m-2-3-16mm-f1-8-manual-iris-c-mount-lens-
10-megapixel-rated/. Accessed: 2017-08-03.
[41] Diffused Dome Light - Metaphase Technologies. https : / / www .
metaphase - tech . com / diffused _ dome _ tube _ lights /
diffused_dome_light. Accessed: 2017-08-03.
[42] White led On-Axis 100x100. http : / / www . phloxgc . com /
datasheet/PHLOX_LEDW_OA_100x100_SLLUB_Q_1R_24V.pdf.
Accessed: 2017-08-04.
60 BIBLIOGRAPHY