1. Introduction
At present, non-destructive testing methods allow for the utilization of technologies to inspect surface defects in the context of additive manufacturing [
1], where surface pattern recognition serves as a powerful tool to detect surface defects [
2]. In this way, non-destructive testing methods have been implemented for the monitoring of microsurface holes and scratches [
3]. Non-destructive testing methods include techniques such as visual testing, ultrasonic testing, acoustic emission, radiographic testing, magnetic particle inspection, and penetration testing [
4]. Ultrasonic testing is performed based on the behavior of sound waves, where a pulse travels through uniform regions but changes in the presence of a discontinuity [
5]. Similarly, acoustic emission testing is carried out by assessing wave disturbances generated by discontinuities on a surface [
6]. Radiographic testing is based on the variation in radiation associated with the thickness of the material [
7]. Magnetic particle testing is performed based on the continuous lines of force, which are distorted by discontinuities in ferromagnetic materials [
8]. Penetration testing is carried out by applying a penetrant liquid to the surface in order to fill any discontinuity, which is then observed by means of fluorescent dyes [
9]. Of the non-destructive testing methods, the simplest and cheapest method is non-destructive visual testing, where surface defect inspection is typically performed in the range between 30 microns and 400 microns [
10]. Therefore, non-destructive visual testing is the most useful method for the inspection of holes and scratches in additively manufactured materials [
11]. The hardware used for visual testing typically includes only a camera and computational algorithms for the inspection of holes and scratches. Thus, non-destructive visual testing has been employed as the standard method to detect surface defects with a minimum depth of 30 microns [
12]. In this way, the present study on surface defect detection was carried out based on visual testing methods. Surface defect recognition is generally applied to inspect surface holes and scratches with a minimum depth of 20 microns, and microsurface defect detection is typically carried out via visual testing by means of computer vision systems based on image processing [
13], where surface defect detection is performed by means of methods such as statistics-, frequency-, and model-based approaches, including machine learning and deep learning models. Statistical methods allow for the detection of surface defects according to the pixel intensity distribution; for instance, a surface defect detection approach has been implemented using statistics [
14], where the surface features are determined via a local binary pattern. Furthermore, surface defect recognition has been performed using a Gauss function modulated in the spatial domain [
15], where the defect features are characterized using a core based on a complete dictionary. Additionally, surface defect detection has been carried out based on texture analysis [
16], where the texture features were obtained by an iterative framework based on the absolute intensity deviation and local aggregation.
In a similar way, frequency-based methods are used to detect surface defects using pixel intensity distributions; for instance, surface defect detection has been performed using the Fourier transform [
17], where the Fourier spectrum of the image under testing is compared with the spectrum of the real sample. Surface defect detection has also been carried out by means of the Fourier transform and the Hough transform [
18], where the presence of surface defects is determined by comparing the difference between the tested image and the original sample. Additionally, surface defect defection has been implemented according to the Fourier transform amplitude [
19], where the amplitude variation in the Fourier spectrum is used to determine surface defects based on a homogeneous image region.
Furthermore, model-based methods allow for surface defect inspection according to the image intensity distribution; for instance, surface defect detection has been performed by means of a hidden Markov model [
20], where the recognition is computed through the hidden Markov model using a library of defects. Additionally, surface defect detection has been performed using a regularized robust principal component model [
21], where a matrix separates the data into a low-rank component and a sparse component to characterize the surface pattern. Additionally, surface defect inspection has been carried out through a model-based approach using the intensity distribution [
22], where a saliency map is determined by a continuous curve that represents the surface edge.
Moreover, machine learning methods can be used to detect surface defects using the pixel intensity distribution; for instance, surface defect detection has been performed via machine learning [
23], where a gray-level image model was generated by training a neural network to determine surface defects. Additionally, surface defect inspection has been implemented via machine learning based on nearby points [
24], where surface defect detection is carried out through a random forest method using a point cloud. Furthermore, surface defect detection has been carried out using neural networks [
25], where potential defect images are compared with original images through the use of a database of defect images.
More recently, surface defect recognition has been implemented via deep learning [
26]; for example, deep features can be determined using residual or convolutional neural networks. For instance, surface defect detection has been performed using a convolutional neural network [
27], where a convolutional matrix was used to extract the features from an image without defects. In a similar way, surface defect detection has been carried out using convolutional neural networks [
28], where a data set of defects was employed to determine surface features by means of a deep convolutional neural network.
The above computer vision techniques allow for the recognition of surface defects through computing the surface features from the pixel intensity distribution. However, the intensity distribution profile does not necessarily depict the topography accurately. This is because the intensity profile varies based on the surface reflectance, light source position, and viewer’s position. Therefore, it has been established that traditional computer vision techniques do not employ the three-dimensional coordinates to perform surface defect detection, leading to some inaccuracies in microsurface defect recognition. Moreover, deep learning approaches employ large models with a great quantity of parameters and thus potentially low accuracy and slow speed [
29]. This is because several hundred images are generally necessary to train neural network models, which leads to the need to perform complex optimization processes to accurately determine the surface defect features. From these statements, it can be deduced that the microsurface recognition of holes and scratches still represents a complicated task. Therefore, it is necessary to implement defect recognition through the use of three-dimensional coordinates to enhance the recognition of microsurface defects.
The proposed microsurface defect recognition approach is performed using three-dimensional coordinates, which are retrieved via microlaser line projection. Furthermore, the microsurface defect recognition approach is implemented via affine moment invariants [
30]. Thus, the affine moment invariants can characterize patterns of holes and scratches through the three-dimensional coordinates, which are contoured via microlaser line scanning. To accomplish this, the affine moment invariants are computed from the surface, which is represented as a Bezier surface. In this way, the Bezier surface is determined using surface coordinates by means of a genetic algorithm. Thus, a pattern of affine moment invariants is computed from the Bezier surface to obtain the pattern of holes and scratches. In this way, a surface defect can be recognized when the pattern of affine moment invariants corresponds to holes or scratches. This procedure is performed to recognize holes and scratches on flat, cylindrical, and free-form surfaces. The microsurface defect recognition approach is carried out using an optical microscope vision system, which includes a CCD camera and a 39 μm laser line. The microlaser line scans the surface and the camera captures the laser line images, thus providing the surface contour. The microsurface coordinates are then computed according to the laser line position and the microscope’s geometry. In this way, the surface defects can be computationally determined from the surface topography coordinates, which are not computed in traditional surface defect detection methods. The proposed surface defect recognition approach can recognize holes and scratches with a minimum depth surface of 30 microns, which is the most common surface defect depth inspected in the context of additive manufacturing. The microscope vision system can inspect a surface area of 3 × 60 cm in one scan as the slider can move the microscope vision system a distance of 60 cm in the
x-axis, while the microscope observes a distance of 3 cm in the
y-axis. The proposed defect recognition technique improves the accuracy of recognizing surface holes and scratches to the microscale. The proposed technique reduces the error of the optical microscope systems to a level smaller than 2%. This enhancement is achieved through the use of a surface contour recovered via the microlaser line projection. Furthermore, the surface defect characterization approach improves the recognition accuracy; this is because the affine moment invariants are computed based on the three-dimensional surface data. In particular, the accuracy is computed according to the relative error provided by the affine moment pattern. The contribution of the proposed microsurface defect recognition approach is established through a discussion based on the accuracy of the techniques performed using optical microscope systems. The remainder of this paper is organized as follows: the surface characterization via affine moment invariants is described in
Section 2.1, the Bezier surface representation is described in
Section 2.2, the contouring of the surface topography via microlaser line projection is described in
Section 2.3, the microsurface defect recognition results are presented in
Section 3, and the key contributions associated with the proposed microsurface defect recognition approach are discussed in
Section 4.
3. Results of Microsurface Defect Recognition
Microsurface defect recognition was performed using the microscope vision system shown in
Figure 5a. In particular, the recognition of holes and scratches was carried out on flat, cylindrical, and free-form surfaces. First, microsurface defect recognition was performed for the metallic flat surface shown in
Figure 6a, where the scale is indicated in
mm in the
x-axis. The laser line projected on the flat surface is also shown in
Figure 6b. Thus, the flat surface was scanned in the
x-direction by the microscope vision system to retrieve the surface contour. During scanning, the camera captured the laser line to determine the laser line position (
xi,j,
yi,j) by computing Equations (26) and (27). Then, the surface depth
zi,j and the surface width
yi,j were calculated by computing Equations (22) and (23), using the position (
xi,j,
yi,j), where the surface coordinate
xi,j is given by the slider platform. Thus, 268 laser lines were processed to retrieve the flat surface topography. The surface contouring accuracy was determined according to the relative error [
34], where a contact method was used for reference measurement. Thus, the relative error of surface contouring was calculated as follows:
In this equation,
hi,j is the surface measurement via contact method,
zi,j is the surface measurement computed via Equation (22), and
n⋅
m denotes the number of data. Thus, Equation (28) was computed and the result indicated a relative error of
Er% = 0.727%. Then, a Bezier surface was computed from the surface retrieved via microlaser line scanning using the genetic algorithm. For this purpose, the surface was divided into regions of 7 × 7 points in order to compute each Bezier surface
SR,T(
u,
v). Furthermore, the weights
w6R+0, 6T+0 = 1,
w6R+6,6T+0 = 1,
w6R+0,6T+6 = 1, and
w6R+6,6T+6 = 1 were established for each Bezier surface. Additionally, the control points (
P6*R,1,
P6*R,2,
P6*R,3,
P6*R,4,
P6*R,5) and (
P1,6*T,
P2,6*T,
P3,6*T,
P4,6*T,
P5,6*T) were computed according to the expressions
P6*R+6,j = (
P6*R+5,j +
P6*R+7,j)/2 and
Pi,6*T = (
Pi,6*T+5 +
Pi,6*T+7)/2 in order to ensure continuity
G1. Then, the genetic algorithm determined the maximum and minimum of each weight
w6R+i,6T+j for the initial Bezier surface via Equation (13). In this context, if
SR,T(
ui,j,
vi,j) was greater than
z6R+i,6T+j, the maximum was equal to 1 and the minimum was provided by the expression (
z6R+i,6T+j–3[
SR,T(
ui,j,
vi,j) −
z6R+i,6Tm+j])/
z6R+i,6T+j. Meanwhile, if
z6R+i,6T+j was greater than
SR,T(
ui,j,
vi,j), the minimum was equal to 1 and the maximum was provided by the expression (
z6R+i,6T+j − 3[
SR,T(
ui,j,
vi,j) −
z6R+i,6T+j])/
z6R+i,6T+j. Thus, the search space was obtained for each weight. Then, four parents were taken randomly from the search space to obtain the initial population for each weight. Next, the current children were generated by computing Equations (15)–(21). Then, the fitness of each
SR,T(
ui,j,
vi,j) was determined through computing Equation (21) by means of the surface
z6R+i,6T+j. Next,
P1, k+1 was selected from (
P1,k,
P2,k),
P3,k+1 from (
P3,k,
P4,k),
P2,k+1 from (
C1,k,
C2,k,
C3,k), and
P4,k+1 from (
C4,k,
C5,k,
C6,k) to serve as the parents for the (
k + 1)th generation. Then, the worst parent with respect to each weight was replaced by a new parent to compute the fitness (Equation (21)). If the new parent enhanced the fitness, the worst parent was mutated; otherwise, the mutation was not performed. Additionally, a new weight was used to replace a weight from a random parent to calculate the fitness via Equation (21). If the new weight enhanced the fitness, the selected weight was mutated; otherwise, mutation was not performed. Then, Equations (15)–(20) were computed to obtain the (
k + 1)th generation children. The procedure to compute the (
k + 1)th generation population was repeated until the objective function (Equation (21)) was minimized. Then, the control points
P6R+i,6T+j = (
w6R+i,6T+j)(
z6R+i,6T+j) were computed using the optimal weights and the surface data. Next, the control points
P6R+i,6T+j were replaced in the Bezier surfaces
S0,0(
u,
v),
S1,0(
u,
v),
S1,0(
u,
v), and
S1,1(
u,
v), ……,
SM,N(
u,
v) to obtain the surface topography shown in
Figure 6c. Here, the scale is represented in
mm in the
x- and
y-axes and in microns in the
z-axis. The accuracy of the Bezier surface was determined according to Equation (28). Here,
zi,j was replaced by the Bezier surface
SR,T(
ui,j,
vi,j) and
hi,j was replaced by the surface retrieved through microlaser line scanning. In this case, the accuracy of the surface shown in
Figure 6c indicated a relative error of
Er% = 0.402%.
Then, surface defect recognition is performed from the Bezier surface shown in
Figure 6c. This procedure was carried out by computing the affine moment invariant Equations (1)–(10), employing regions of 34 × 34 surface points. The central moments
μp,q of each region were also computed by means of Equations (11) and (12). Here, the surface depth is represented by
f(
xi,j,
yi,j) =
zi,j, and the sub-indices (
i,
j) denote the number of surface points in the
x- and
y-axes. Equations (1)–(10) were computed to establish the pattern of affine moment invariants for each region. The result of the affine moment invariants for the flat surface was as follows:
I1 = 4.6776 × 10
−6,
I2 = −1.8352 × 10
−31,
I3 = −1.4511 × 10
−18,
I4 = −3.6474 × 10
−23,
I5 = 1.3521 × 10
−10,
I6 = 2.2314 × 10
−16,
I7 = 5.4774 × 10
−10,
I8 = 7.9281 × 10
−16,
I9 = 6.7816 × 10
−33, and
I10 = −5.0054 × 10
−39. This pattern describes a decreasing function from
I1 to
I4, where the function peak
I1 is smaller than 4.6776 × 10
−6 and the moments (
I2,
I3,
I4) are negative. Meanwhile, the function increased from
I5 to
I7, then tended to zero from
I8 to
I10. In this way, the pattern of affine moment invariants was established. This is elucidated through the next pattern of affine moment invariants for the flat surface:
I1 = 4.2802 × 10
−6,
I2 = −2.3213 × 10
−32,
I3 = −1.8357 × 10
−19,
I4 = −2.4127 × 10
−23,
I5 = 1.1322 × 10
−10,
I6 = 1.7093 × 10
−16,
I7 = 4.5861 × 10
−10,
I8 = 6.0742 × 10
−16,
I9 = 0, and
I10 = 0. Here, the function peak
I1 is smaller than 4.6776 × 10
−6 and the moments (
I2,
I3,
I4) are negative. Then, the window was moved in the
x- and
y-directions to compute the pattern of affine moment invariants for each surface region. When the window covered the hole, the surface shown in
Figure 6d was obtained. In this case, a discontinuity appears in the
y-axis surface profile, which is indicated by the microlaser line projection. This surface discontinuity was detected when the derivative ∂
f(
y,
x)/∂
y changes signs in the
y-axis. This criterion is described based on the surface profile discontinuity shown in
Figure 3d. Additionally, the surface defect depth was determined by computing the difference between the minimum of the surface defect and the maximum of the surface defect. Here, the surface profile
f(
y,
x) =
zi,j was computed via Equation (22), and the surface profile width
yi,j was computed via Equation (23). In this case, the maximum of the surface defect was obtained at the border of the surface defect in the
y-axis. Also, the presence of a hole is established when the surface discontinuity depth is greater at the borders than in the center in both the
x- and
y-axes. Based on these statements, the hole length is 336 microns in the
x-axis, the hole width is 438 microns in the
y-axis, and the hole depth is 32 microns in the
z-axis. The bottom of the hole is an irregular surface, presenting topographic variation. Thus, the hole surface was represented as a Bezier surface with smoothed topography in order to compute the pattern of affine moment invariants, and the result was
I1 = 1.0513 × 10
−5,
I2 = −1.4891 × 10
−22,
I3 = 3.0546 × 10
−14,
I4 = −2.4710 × 10
−18,
I5 = 6.5353 × 10
−10,
I6 = 2.3198 × 10
−15,
I7 = 8.5784 × 10
−8,
I8 = 6.0742 × 10
−16,
I9 = 1.6635 × 10
−27, and
I10 = −1.6881 × 10
−29. This pattern describes a decreasing function from
I1 to
I4, where
I1 represents the function peak and (
I2,
I4) are negative. Then, the function increases to
I7, which represents a peak, and tends to zero from
I8 to
I10. The peaks
I1 and
I7 are larger than those of the flat surface, so it is considered that a hole defect was detected.
This determination occurred as the hole peak was greater than 4.7 × 10−6, I4 was negative, and the peak I7 was greater than that of the flat surface. Additionally, the surface defect was greater at the borders than in the center in both the x- and y-axes. Based on these statements, it was deduced that the pattern of affine moment invariants corresponded to a hole surface defect. Thus, the shown region contoured by the microlaser line was recognized as a microhole surface defect according to the pattern of affine moment invariants.
The second microsurface defect recognition test was performed using the cylindrical metallic surface shown in
Figure 7a (where the scale is indicated in millimeters in the
x-direction). The microlaser line projected onto the cylindrical surface is shown in
Figure 7b. Thus, the cylindrical surface was scanned in the
x-direction using the microscope vision system to retrieve the surface contour. From the scanning result, the laser line position (
xi,j,
yi,j) was computed using Equations (26) and (27). Then, the surface depth
zi,j and the surface width
yi,j were obtained by computing Equations (22) and (23). The surface coordinate
xi,j is provided by the slider platform. Thus, 242 laser lines were processed to retrieve the microcylindrical surface. The surface contouring accuracy was determined via Equation (28), where
zi,j denotes the surface measured via the contact method,
hi,j is the surface contour computed via Equation (22), and
n⋅
m is the number of data. From the computed result, a relative error of
Er% = 0.818% was determined. Then, a Bezier surface was computed from the surface retrieved via microlaser line scanning using the genetic algorithm. For this purpose, the cylindrical surface was divided into regions of 7 × 7 points to compute each Bezier surface
SR,T(
u,
v). Furthermore, for each Bezier surface, the weights
w6R+0, 6T+0 = 1,
w6R+6,6T+0 = 1,
w6R+0,6T+6 = 1, and
w6R+6,6T+6 = 1 were established. Meanwhile, the control points (
P6*R,1,
P6*R,2,
P6*R,3,
P6*R,4,
P6*R,5) and (
P1,6*T,
P2,6*T,
P3,6*T,
P4,6*T,
P5,6*T) were computed according to the expressions
P6*R+6,j = (
P6*R+5,j+
P6*R+7,j)/2 and
Pi,6*T = (
Pi,6*T+5 +
Pi,6*T+7)/2 in order to ensure continuity
G1. Then, the first step of the genetic algorithm was performed to determine the maximum and minimum value of each weight
w6R+i,6T+j through the initial Bezier surface Equation (13). If
SR,T(
ui,j,
vi,j) was greater than
z6R+i,6T+j, the maximum was equal to 1, and the minimum was computed using the expression (
z6R+i,6T+j − 3[
SR,T(
ui,j,
vi,j) −
z6R+i,6Tm+j])/
z6R+i,6T+j. Meanwhile, if
z6R+i,6T+j was greater than
SR,T(
ui,j,
vi,j), the minimum was equal to 1 and the maximum was calculated according to the expression (
z6R+i,6T+j − 3[
SR,T(
ui,j,
vi,j) −
z6R+i,6T+j])/
z6R+i,6T+j. Then, four parents were collected at random from the search space to obtain the initial population for each weight. Next, the current children were generated by computing Equations (15)–(21). Then, the fitness of each
SR,T(
ui,j,
vi,j) was determined by computing Equation (21) according to the surface
z6R+i,6T+j. Next,
P1, k+1 was selected from (
P1,k,
P2,k),
P3,k+1 from (
P3,k,
P4,k),
P2,k+1 from (
C1,k,
C2,k,
C3,k), and
P4,k+1 from (
C4,k,
C5,k,
C6,k), serving as the parents of the (
k + 1)-generation. Next, the worst parent was replaced by a new parent for each weight and the fitness was calculated according to Equation (21). If the new parent enhanced the fitness, the worst parent was replaced; otherwise, mutation was not performed. Additionally, a new weight replaced a weight from a randomly chosen parent and the fitness was calculated via Equation (21). If the new weight enhanced the fitness, the selected weight was mutated; otherwise, mutation was not performed. Then, Equations (15)–(20) were computed to obtain the (
k + 1)th generation children. The procedure to compute the (
k + 1)th generation population was repeated until the objective function (Equation (21)) had been minimized. Then, the control points
P6R+i,6T+j = (
w6R+i,6T+j)(
z6R+i,6T+j) were calculated using the optimal weights. Next, the control points
P6R+i,6T+j were replaced in the Bezier surfaces
S0,0(
u,
v),
S1,0(
u,
v),
S1,0(
u,
v), and
S1,1(
u,
v), ……,
SM,N(
u,
v) to obtain the surface topography shown in
Figure 7c, where the scale is presented in
mm for the
x- and
y-axes but in microns for the
z-axis. The accuracy of the Bezier surface was determined via Equation (28). For this purpose,
zi,j was replaced by the Bezier surface
SR,T(
ui,j,
vi,j) and
hi,j was replaced by the surface retrieved through microlaser line scanning. The results indicated a relative error of
Er% = 0.5305%. Then, surface defect recognition was performed using the Bezier surface shown in
Figure 7c. This procedure was carried out by computing the affine moment invariants via Equations (1)–(10), employing regions of 38 × 38 surface points. Furthermore, the central moments
μp,q of each region were computed via Equations (11) and (12) by means of the surface depth
f(
xi,j,
yi,j) =
zi,j, where the sub-indices (
i,
j) depict the number of surface points in the
x- and
y-axes. Thus, Equations (1)–(10) were computed to establish the pattern of affine moment invariants for each region. The resulting affine moment invariants on the cylindrical surface were as follows:
I1 = 3.9808 × 10
−6,
I2 = −4.9844 × 10
−74,
I3 = 2.6080 × 10
−40,
I4 = −4.3482 × 10
−45,
I5 = 9.8394 × 10
−11,
I6 = 1.3935 × 10
−16,
I7 = 3.9194 × 10
−10,
I8 = 4.9154 × 10
−16,
I9 = −1.9091 × 10
−66, and
I10 = 1.8154 × 10
−82. This pattern describes a decreasing function from
I1 to
I4, where
I1 represents the peak. Meanwhile, the function increases from
I5 to
I7, then decreases from
I8 to
I10. From this pattern, it is deduced that the peak
I1 is smaller than those for the flat surface and the hole surface defect. Furthermore, the peak
I7 is also smaller than those for the flat surface and the hole surface defect. This criterion is elucidated by the pattern of affine moment invariants for another cylindrical surface:
I1 = 4.0776 × 10
−6,
I2 = −1.1929 × 10
−48,
I3 = 8.9806 × 10
−28,
I4 = −7.8272 × 10
−25,
I5 = 1.0294 × 10
−10,
I6 = 1.4854 × 10
−16,
I7 = 4.1449 × 10
−10,
I8 = 5.2635 × 10
−16,
I9 = 6.3026 × 10
−54, and
I10 = −4.2746 × 10
−45. Then, the window is moved in the
x-direction and
y-direction to compute the pattern of affine moment invariants in each surface region. When the window covered a hole, an irregular topography was determined. In this case, a discontinuity appears in the
y-axis in the surface profile, which is provided by the microlaser line projection. This surface discontinuity was detected due to the derivative ∂
f(
y,
x)/∂
y changing sign in the
y-axis. The surface defect depth was determined by computing the difference between the minimum and maximum depth values for the surface defect. The surface profile
f(
y,
x) =
zi,j was computed via Equation (22), and the surface profile width
yi,j was computed via Equation (23). Meanwhile, the maximum of the surface defect is obtained at the border of the surface defect in the
y-axis. Furthermore, the presence of a hole was established as the surface discontinuity depth was greater at the borders than in the center in both the
x- and
y-axes. In this case, the hole presented an irregular topography, with variations in the
x-,
y-, and
z-axes. The hole length was 620 microns in the
x-axis, the hole width was 504 microns in the
y-axis, and the hole depth was 32 microns in the
z-axis.
The hole surface was represented by the Bezier surface to compute the pattern of affine moment invariants and the results were as follows:
I1 = 4.9004 × 10
−6,
I2 = −6.1116 × 10
−24,
I3 = 2.1951 × 10
−15,
I4 = −9.1065 × 10
−20,
I5 = 1.4666 × 10
−10,
I6 = 2.5385 × 10
−16,
I7 = 6.4527 × 10
−9,
I8 = 9.0208 × 10
−16,
I9 = 5.7381 × 10
−29, and
I10 = −2.2245 × 10
−31. This pattern describes a decreasing function from
I1 to
I4, where
I1 represents the function’s peak. The function then increased until
I7 and tended to zero from
I8 to
I10. In this case, it can be deduced that the peak
I1 was greater than those for the flat and cylindrical surfaces. Furthermore, the peak
I7 was greater than those for the flat and cylindrical surfaces. In this way, the characteristic pattern of the hole surface defect was recognized as the function peak
I1 was greater than 4.7 × 10
−6 and (
I2,
I4) were negative. Furthermore, the surface defect was greater at the borders than in the center in both the
x- and
y-axes. Based on these statements, it can be deduced that the pattern of affine moment invariants corresponded to a hole surface defect. From this pattern of affine moment invariants, the surface defect was recognized as a hole. Thus, a region contoured by the microlaser line was recognized as a microsurface hole defect on a cylindrical surface. Then, the window size was modified to 38 × 26 surface points to perform microsurface defect recognition based on the presence of scratches. When the window covered the scratched area indicated by the arrow, the surface shown in
Figure 7d was obtained. In this case, a discontinuity appeared in the
y-axis in the surface profile provided by the microlaser line projection. This surface discontinuity was detected when the derivative ∂
f(
y,
x)/∂
y changed signs in the
y-axis. The surface defect depth was determined by computing the difference between the minimum and maximum depth values of the surface defect, where the surface profile
f(
y,
x) =
zi,j was computed via Equation (22) and the surface profile width
yi,j was computed via Equation (23). The maximum of the surface defect was obtained on the border of the surface defect in the
y-axis, and the presence of a scratch can be established when the surface discontinuity depth is not greater at the borders than in the center in the
x-axis. The scratch length was 412 microns in the
x-axis, the scratch width was 298 microns in the
y-axis, and the scratch depth was 22 microns in the
z-axis. The bottom of the scratch presents an irregular surface, which contains topographic variations in the
x-,
y-, and
z-axes. The pattern of affine moment invariants was computed from the Bezier surface using Equations (1)–(10), and the result was as follows:
I1 = 5.4895 × 10
−6,
I2 = −1.7040 × 10
−24,
I3 = 9.0153 × 10
−16,
I4 = −2.5433 × 10
−20,
I5 = 1.8663 × 10
−10,
I6 = 3.6278 × 10
−16,
I7 = 5.1067 × 10
−9,
I8= 1.284910
−15,
I9 = 9.5397 × 10
−30, and
I10 = −1.3892 × 10
−32. This pattern indicates a decreasing function from
I1 to
I4, where
I1 represents the function peak and (
I2,
I4) are negative. Then, the function increases to
I7, which represents a peak, following which the function tends to zero from
I8 to
I10. Additionally, the peak
I1 is greater than 4.7 × 10
−6. Furthermore, the surface defect is not greater at the borders than in the center in the
x-axis. From this pattern of affine moment invariants, the surface defect was recognized as a scratch. Thus, a region contoured by the microlaser line was recognized as a scratch-type microdefect on a cylindrical surface. This criterion was elucidated by the pattern of affine moment invariants of another scratch-type surface defect as follows:
I1 = 5.4084 × 10
−6,
I2 = 1.5246 × 10
−25,
I3 = −1.2930 × 10
−15,
I4 = −4.0845 × 10
−21,
I5 = 1.8104 × 10
−10,
I6 = 3.4704 × 10
−16,
I7 = 4.9610 × 10
−9,
I8 = 1.2282 × 10
−15,
I9 = 3.0332 × 10
−30, and
I10 = −2.6570 × 10
−33. Here, the peak
I1 is greater than 4.7 × 10
−6, and the surface defect is not greater at the borders than in the center in the
x-axis.
Next, microsurface defect recognition was performed on the plastic free-form surface shown in
Figure 8a, where the scale is indicated in millimeters in the
x-direction. The microlaser line projected onto the plastic free-form surface is shown in
Figure 8b. The free-form surface was scanned via microlaser line in the
x-axis to compute the surface depth
zi,j and the surface width
yi,j via Equations (22) and (23). The coordinate
xi,j was obtained from the slider platform. Thus, 232 laser lines were processed to retrieve the free-form surface. The surface accuracy was determined via Equation (28), where
zi,j was the surface measured via contact method,
hi,j was the surface contour computed via Equation (22), and
n⋅
m denotes the number of data. Thus, the result indicated a relative error of
Er% = 0.883%. Then, the Bezier surfaces
S0,0(
u,
v),
S1,0(
u,
v),
S1,0(
u,
v), and
S1,1(
u,
v), ……,
SM,N(
u,
v) were computed using the genetic algorithm to obtain the surface topography shown in
Figure 8c. Here, the scale is represented in
mm for the
x- and
y-axes and in microns for the
z-axis. The Bezier surface accuracy was calculated via Equation (28). Here,
zi,j is given by the Bezier surface
SR,T(
ui,j,
vi,j) and
hi,j is the surface retrieved through microlaser line scanning. The result indicated a relative error of
Er% = 0.617%. Then, the pattern of affine moment invariants was computed from the Bezier surface shown in
Figure 8c to recognize the microsurface holes. For this purpose, the affine moment invariants were computed for each surface region using Equations (1)–(10).
In this way, the central moments
μp,q for each region were computed by means of Equations (11) and (12), where the surface depth is represented by
f(
xi,j,
yi,j) =
zi,j. Thus, the pattern of affine moment invariants was computed for the free-form surface. When the window covered hole 1, as shown in
Figure 8c, a discontinuity appeared in the
y-axis of the surface profile. This surface discontinuity was detected when the derivative ∂
f(
y,
x)/∂
y changed signs in the
y-axis. The surface of this hole is shown in
Figure 8d, where the hole length was 410 microns in the
x-axis and the hole width was 480 microns in the
y-axis. The surface defect depth was determined by computing the difference between the minimum and maximum depths of the surface defect, where the surface profile
f(
y,
x) =
zi,j was computed via Equation (22) and the surface profile width
yi,j was computed via Equation (23). As expected, the maximum of the surface defect was obtained on the border of the surface defect in the
y-axis. The hole depth was 34 microns in the
z-axis, and the bottom of this hole presented surface irregularities. Thus, the pattern of affine moment invariants was computed, resulting in
I1 = 5.1340 × 10
−6,
I2 = −1.2086 × 10
−23,
I3 = 2.3292 × 10
−15,
I4 = −9.8397 × 10
−20,
I5 = 1.5805 × 10
−10,
I6 = 2.8393 × 10
−16,
I7 = 7.0254 × 10
−9,
I8 = 1.0185 × 10
−15,
I9 = 8.9124 × 10
−29, and
I10 = −3.2539 × 10
−31. This pattern describes a decreasing function from
I1 to
I4, following which the function increases until
I7. Then, the function tends to zero from
I8 to
I10. In this case, the peak
I1 was greater than 4.7 × 10
−6 and (
I2,
I4) are negative; therefore, the region was recognized as a hole defect, particularly as the surface bottom was greater at the borders than in the center of the
x- and
y-axes. In the same way, a surface discontinuity appeared on the surface profile of hole 2, which is marked with an arrow in
Figure 8c. The hole length was 260 microns in the
x-axis, the hole width was 280 microns in the
y-axis, and the hole bottom was 22 microns in the
z-axis. Thus, the pattern of affine moment invariants was computed, given as follows:
I1= 8.9378 × 10
−6,
I2 = −1.3273 × 10
−22,
I3 = 1.3318 × 10
−14,
I4 = −7.3403 × 10
−19,
I5 = 4.7081 × 10
−10,
I6 = 1.4533 × 10
−15,
I7 = 2.0972 × 10
−8,
I8 = 5.2772 × 10
−15,
I9 = 1.5830 × 10
−27, and
I10 = −8.9553 × 10
−30. In this case, the peak
I1 is greater than 4.7 × 10
−6 and (
I2,
I4) are negative; therefore, the region is recognized as a hole defect. As the surface bottom was greater at the borders than in the center of both the
x- and
y-axes, it was deduced that the pattern of affine moment invariants corresponded to a hole surface defect. Additionally, the pattern of affine invariant moments was computed for all the regions of the free-form surface, but the patterns were different to those for hole and scratch defects.
The fourth microsurface defect recognition test was carried out for the metallic flat surface shown in
Figure 9a. The microlaser line was projected to retrieve the surface topography, and the flat surface was scanned in the
x-axis to allow for computation of the surface depth
zi,j and the surface width
yi,j via Equations (22) and (23), while the slider platform provided the coordinate
xi,j. Thus, 228 laser lines were processed to retrieve the flat surface. The accuracy of this surface indicated a relative error of
Er% = 0.795%, as computed via Equation (28). Here,
zi,j is the surface measured via contact method,
hi,j is the surface contour computed via Equation (22), and
n⋅
m is the number of data. Then, Bezier surfaces
S0,0(
u,
v),
S1,0(
u,
v),
S1,0(
u,
v), and
S1,1(
u,
v),……,
SM,N(
u,
v) were computed to obtain the surface topography shown in
Figure 10b. Here, the scale is indicated in
mm in the
x- and
y-axes, and in microns for the
z-axis. According to Equation (28), the Bezier surface presented a relative error of
Er%= 0.601%. Then, the recognition of microscratches was performed by computing the pattern of affine moment invariants for each region of the Bezier surface shown in
Figure 9b. This procedure was carried out by computing Equations (1)–(10) for each region of the flat surface. For this purpose, Equations (11) and (12) were computed to obtain the central moments of each region. Then, Equations (1)–(10) were computed to obtain the affine moment invariants on the flat surface, yielding
I1 = 4.0635 × 10
−6,
I2 = −2.3280 × 10
−29,
I3 = −1.5206 × 10
−17,
I4 = −3.3215 × 10
−22,
I5 = 1.0203 × 10
−10,
I6 = 1.4636 × 10
−16,
I7 = 4.1340 × 10
−10,
I8 = 5.1978 × 10
−16,
I9 = 2.0020 × 10
−31, and
I10 = −4.7761 × 10
−39. This result is similar to the pattern of affine moment invariants for a flat surface, where the peak
I1 is smaller than 4.7 × 10
−6. Then, the presence of a discontinuity was detected by computing the derivative ∂
f(
y,
x)/∂
y in the
y-axis, associated with the point at which the derivative changes sign in the
y-axis. In this way, the window was moved to the location of the scratch marked with an arrow in
Figure 9b. In this way, the surface shown in
Figure 9c was obtained. The scratch length was 440 microns in the
x-axis and its width was 202 microns in the
y-axis. Furthermore, the surface defect depth was determined by computing the difference between the minimum and maximum depth values of the surface defect, where the surface profile
f(
y,
x) =
zi,j was computed via Equation (22). The maximum of the surface defect was obtained on the border of the surface defect in the
y-axis, and the scratch depth was found to be 28 microns in the
z-axis, with the bottom presenting surface irregularities. Thus, the pattern of affine moment invariants was computed from the Bezier surface, and the resulting values were
I1 = 1.5337 × 10
−5,
I2 = −2.0332 × 10
−24,
I3 = −4.6206 × 10
−15,
I4 = −1.3259 × 10
−20,
I5 = 1.3140 × 10
−9,
I6 = 5.7091 × 10
−15,
I7 = 2.8682 × 10
−8,
I8 = 2.4603 × 10
−14,
I9 = 8.4472 × 10
−29, and
I10 = 2.0184 × 10
−30. This pattern indicates a decreasing function from
I1 to
I4, after which the function increased until
I7. Then, the function tended to zero from
I8 to
I10. In this case, the peak
I1 was greater than 4.7 × 10
−6, and the surface bottom was not greater at the border than in the center of the
x-axis. Therefore, the region was recognized as a scratch defect. This criterion was elucidated by moving the window in the
x-axis to compute the pattern of the neighboring region. Thus, the pattern of affine moment invariants was computed, yielding
I1 = 1.6157 × 10
−5,
I2 = −1.0939 × 10
−24,
I3 = −7.0285 × 10
−16,
I4 = −2.1275 × 10
−21,
I5 = 1.4549 × 10
−10,
I6 = 6.6265 × 10
−15,
I7 = 3.1959 × 10
−8,
I8 = 2.8683 × 10
−14,
I9 = 1.9100 × 10
−29, and
I10 = 3.2143 × 10
−31. This result is similar to that of the scratch marked by the arrow in
Figure 9b. Here, the function decreases from
I1 to
I4, then increases until
I7, and finally tends to zero from
I8 to
I10. In this case, the peak
I1 is greater than 4.7 × 10
−6 and the surface bottom is not greater at the borders than in the center of the
x-axis. Therefore, the region is recognized as a scratch defect.
The fifth microsurface defect recognition test was carried out on the plastic free-form surface shown in
Figure 10a. Here, the scale is represented in millimeters in the
x-direction. Additionally, the microlaser line projected onto the free-form surface is shown in
Figure 10b. Thus, the free-form surface was scanned in the
x-axis to compute the surface depth
zi,j and the surface width
yi,j via Equations (22) and (23), while the slider platform provided the coordinate
xi,j. Thus, 310 laser lines were processed to retrieve the free form surface. The contouring accuracy indicated a relative error of
Er% = 0.826%, as computed via Equation (28) in a similar manner as mentioned above. Then, Bezier surfaces
S0,0(
u,
v),
S1,0(
u,
v),
S1,0(
u,
v), and
S1,1(
u,
v), ……,
SM,N(
u,
v) were computed to obtain the surface topography shown in
Figure 10c, where the scale is indicated in
mm for the
x- and
y-axes and in microns for the
z-axis. The Bezier surface accuracy indicated a relative error of
Er% = 0.641%, as computed via Equation (28). Then, microsurface defect recognition was performed by computing the pattern of affine moment invariants from each region of the Bezier surface shown in
Figure 10c. For this purpose, Equations (1)–(10) were computed for each region, and Equations (11) and (12) were computed to obtain the central moments for each region. Then, a discontinuity was detected by computing the derivative ∂
f(
y,
x)/∂
y in the
y-axis due to the derivative changing signs in the
y-axis. In this way, the window was moved to cover scratch 1 (marked with an arrow in
Figure 10c). In this case, the surface shown in
Figure 10d was obtained, where the scratch length was 610 microns in the
x-axis and the scratch width was 286 microns in the
y-axis.
The surface defect depth was also determined by computing the difference between the minimum and maximum depths of the surface defect, where the surface profile
f(
y,
x) =
zi,j was computed via Equation (22). The maximum of the surface defect was obtained on the border of the surface defect in the
y-axis. Therefore, the depth of scratch 1 was determined as 28 microns in the
z-axis. Furthermore, the bottom of the scratch presented surface irregularities. The pattern of affine moment invariants was computed, and the result was as follows:
I1 = 1.4788 × 10
−5,
I2 = −1.6251 × 10
−23,
I3 = −8.7892 × 10
−17,
I4 = −1.8519 × 10
−20,
I5 = 1.2225 × 10
−9,
I6 = 5.1200 × 10
−15,
I7 = 2.6508 × 10
−8,
I8 = 2.2065 × 10
−14,
I9 = 2.5372 × 10
−28, and
I10 = 1.1187 × 10
−30. This pattern describes a decreasing function from
I1 to
I4, after which the function increases until
I7. Then, the function tends to zero from
I8 to
I10. In this case, the peak
I1 is greater than 4.7 × 10
−6; therefore, this region was recognized as a scratch, particularly as the surface bottom was not greater at the borders than in the center of the
x-axis. This criterion was elucidated by obtaining the pattern of affine moment invariants of the scratch 2 surface defect, resulting in
I1 = 5.4084 × 10
−6,
I2 = 1.5246 × 10
−25,
I3 = −1.2930 × 10
−15,
I4 = −4.0845 × 10
−21,
I5 = 1.8104 × 10
−10,
I6 = 3.4704 × 10
−16,
I7 = 4.9610 × 10
−9,
I8 = 1.2282 × 10
−15,
I9 = 3.0332 × 10
−30, and
I10 = −2.6570 × 10
−33. In this case, the peak
I1 was greater than 4.7 × 10
−6, and the surface bottom was not greater at the borders than in the center of the
x-axis. Additionally, the pattern of affine moment invariants was computed for the hole, also marked with an arrow in
Figure 10c. Here, the hole length was 460 microns in the
x-axis, the hole width was 534 microns in the
y-axis, and the hole depth was 46 microns in the
z-axis. The hole’s bottom presented surface irregularities. The pattern of affine moment invariants is computed, yielding
I1 = 1.1280 × 10
−5,
I2 = −3.0274 × 10
−21,
I3 = 1.0087 × 10
−13,
I4 = −3.3440 × 10
−18,
I5 = 6.5086 × 10
−10,
I6 = 2.2408 × 10
−15,
I7 = 1.0998 × 10
−8,
I8 = 9.1200 × 10
−15,
I9 = 4.1001 × 10
−26, and
I10 = −8.2710 × 10
−29. This pattern describes a decreasing function from
I1 to
I4, while the function increases to
I7 and then tends to zero from
I8 to
I10. In this case, the peak
I1 is greater than 4.7 × 10
−6, while
I4 is negative. Therefore, the region was recognized as a hole defect, particularly as the surface bottom was greater at the borders than in the center of both the
x- and
y-axes. In the same way, the pattern of affine invariant moments was computed for all the regions of the free-form surface, but these differed from the hole and scratch defect patterns.
The sixth microsurface defect recognition test was carried out for the metallic free-form surface shown in
Figure 11a, where the scale is indicated in millimeters in the
x-axis. The microlaser line projected onto the metallic free form surface is also shown in
Figure 11b. Thus, the free-form surface was scanned in the
x-axis to compute the surface depth
zi,j and the surface width
yi,j via Equations (22) and (23), while the slider platform provided the coordinate
xi,j. Thus, 224 laser lines were processed to retrieve the free-form surface. The contouring accuracy presented a relative error of
Er% = 0.884%, as computed via Equation (28). Then, Bezier surfaces
S0,0(
u,
v),
S1,0(
u,
v),
S1,0(
u,
v),and
S1,1(
u,
v), ……,
SM,N(
u,
v) were computed to obtain the surface topography shown in
Figure 11c. Here, the scale is indicated in
mm for the
x- and
y-axes and in microns for the
z-axis. The Bezier surface accuracy yielded a relative error of
Er% = 0.664%, which was computed via Equation (28). Then, microsurface defect recognition was performed by computing the pattern of affine moment invariants for each region of the Bezier surface shown in
Figure 11c. In particular, Equations (1)–(10) were computed for each region, and Equations (11) and (12) were computed to obtain the central moments for each region. Thus, the affine moment invariants were computed to establish the pattern in each region. Then, a discontinuity was detected by computing the derivative ∂
f(
y,
x)/∂
y in the
y-axis, revealing the hole shown in
Figure 11c, which corresponded to the location where the derivative changed signs in the
y-axis. In this case, the surface shown in
Figure 11d was obtained. Here, the hole length was 472 microns in the
x-axis, the hole width was 400 microns in the
y-axis, and the hole depth was 27 microns in the
z-axis, with the hole’s bottom presenting surface irregularities. The pattern of affine moment invariants is computed from the Bezier surface, yielding
I1 = 8.6825 × 10
−6,
I2 = −5.7967 × 10
−24,
I3 = 3.4759 × 10
−16,
I4 = −1.8328 × 10
−18,
I5 = 4.4638 × 10
−10,
I6 = 1.3420 × 10
−15,
I7 = 1.9741 × 10
−8,
I8 = 4.8606 × 10
−15,
I9 = 5.29607 × 10
−27, and
I10 = −3.9497 × 10
−29. This pattern describes a decreasing function from
I1 to
I4, after which the function increases to
I7. Then, the function tends to zero from
I8 to
I10. In this case, the peak
I1 was greater than 4.7 × 10
−6. Therefore, the region is recognized as a hole defect, particularly as the surface bottom was greater at the borders than in the center of both the
x- and
y-axes. In the same way, the pattern of affine invariant moments was computed for all the regions of the free-form surface, but these patterns differed from the hole and scratch defect patterns.
In the following, the contributions of the proposed microsurface defect recognition are described based on its advantages over the existing hole and scratch detection methods using optical-microscope-based systems. The advantages of the proposed visual testing method are described as follows. First, the patterns of affine moment invariants and microlaser scanning provide high accuracy (with a maximum relative error of 0.721% in the tests) to recognize microholes and scratches. The validation of this accuracy was performed by computing the pattern of affine moment invariants from the surface profiles measured using the contact method and microlaser line projection. The pattern recognition of holes and scratches using the contact method is considered to be the most accurate procedure to detect surface defects as this method utilizes the real surface profile. Therefore, the pattern of affine moment invariants via microlaser line projection was compared with respect to that obtained via the contact method to obtain the accuracy. In this way, the accuracy of patterns of affine moment invariants was computed as the relative error by means of Equation (28), where
zi,j denotes the affine moment invariants computed from the surface measured via contact method,
hi,j is the affine moment invariants computed via the microlaser line Equation (22), and
n⋅
m is the number of data. In particular,
zi,j and
hi,j are substituted by (
I1,
I2,
I3,
I4,
I5,
I6,
I7,
I8,
I9,
I10) by employing the sub-index
zi,j = Ii for
j = 0. In this way, the accuracy provided by the microscope vision system and the affine moment invariants was found to be less than 2%, which is the level typically provided by traditional defect detection methods. However, it should be noted that, for traditional defect detection methods, the accuracy is computed as (TP + TN)/(TP + FP +TN + FN) by means of the expressions for precision = TP/(TP + FP) and recall = TP/(TN + FN) [
35]. Here, TP denotes true positives, FP denotes false positives, TN denotes true negatives, and FN denotes false negatives. Overall, the accuracy obtained when using the pattern of affine moment invariants provided an advantage over traditional optical-microscope-system-based methods due to the obtained relative error being lower than 2%. Second, the use of affine moment invariants and microlaser line contouring provides good robustness in terms of the characterization of microholes and scratches. In this regard, a hole surface defect contoured using a microlaser line provides the same pattern of affine moment invariants. This allowed us to consistently recognize hole surface defects in each test. In the same way, scratch surface defects contoured via microlaser line always provide the same pattern of affine moment invariants. Thus, scratch surface defects can also be consistently recognized. In addition, flat and cylindrical surfaces contoured via microlaser lines produced the same respective patterns of affine moment invariants in each test. Third, microlaser line contouring provides the real topography of microsurfaces as the microlaser line reflects the real surface contour onto the camera’s image plane. In contrast, traditional optical microscope systems do not retrieve a surface contour to perform surface defect recognition. Based on these statements, the recognition of microholes and scratches has been achieved in a generally superior manner. A further discussion of the contributions of the proposed microsurface defect recognition approach is provided in
Section 4.