Next Article in Journal
An Improved VGG19 Transfer Learning Strip Steel Surface Defect Recognition Deep Neural Network Based on Few Samples and Imbalanced Datasets
Previous Article in Journal
Gross Ammonification and Nitrification Rates in Soil Amended with Natural and NH4-Enriched Chabazite Zeolite and Nitrification Inhibitor DMPP
Previous Article in Special Issue
A Hybrid Wind Power Forecasting Model with XGBoost, Data Preprocessing Considering Different NWPs
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Automated Optical Inspection System for O-Ring Based on Photometric Stereo and Machine Vision

1
Graduate Institute of Manufacturing Technology, Department of Mechanical Engineering, National Taipei University of Technology, 1, Sec. 3, Zhongxiao E. Rd., Taipei 10608, Taiwan
2
Department of Mechanical Engineering, National Taiwan University, 1, Sec. 4, Roosevelt Rd., Taipei 10617, Taiwan
*
Author to whom correspondence should be addressed.
Appl. Sci. 2021, 11(6), 2601; https://doi.org/10.3390/app11062601
Submission received: 5 February 2021 / Revised: 8 March 2021 / Accepted: 8 March 2021 / Published: 15 March 2021

Abstract

:
This research developed an AOI (automated optical inspection) system for the O-Ring inspection. First, an AOI system was implemented to detect surface scratches, flow marks, non-fills, and indentations on elastomer O-Rings with high surface reflection coefficients. The proposed system employed multiple light source structures to realize the photometric stereo. This method eased the identification of the O-Ring contour and Bézier control points. Then, by applying an interpolation process on these control points, we estimated the paths of the object surface. Simultaneously, regression analysis was conducted to produce a new smooth surface and then a constructed surface was compared with the model built by the photometric stereo method. The difference was deemed the candidate defect location. Overall, the detection recall rate was 100% and accuracy reached 96.56%. This paper also developed an AOI system for the O-Ring dimension measurement. The system analyzed the contour of the O-Ring and reversely calculated the Bézier curve control points. Then, those control points were used with De Casteljau’s algorithm to estimate the O-Ring dimension with high accuracy.

1. Introduction

Recently, the automated optical inspection (AOI) system has taken the place of human inspection in highly automated manufacturing requirements. Human inspection is subjective since human inspection stability depends on operator experience and physical condition, among other factors. However, there are many reasons that make human inspection irreplaceable. For example, we cannot use a fixed light source to obtain a defect image unless we employ a light source at a particular relative direction to catch defect features on the O-Ring’s surface. A such, the AOI system has experiences many ordeals in various conditions. It is difficult to exploit the traditional image process of dealing with images from cameras captured from different light sources. Therefore, it is difficult to fix a threshold for traditional image processing.
To address this problem, we studied other research that inspected rubber material. Peng et al. [1] used 7 × 7 kernels to find the gradient direction and convert the edge of this area to a cubic spline to measure the O-Ring dimension and to remove noise. Simultaneously, this study used the KFDA (kernel fisher discriminant analysis) to detect the O-Ring defect. Ho et al. [2] used two inspection stations to inspect components made of rubber and metal. The first inspection station provided a camera and light source to inspect defects on the top of the component. The second inspection station provided a camera and a special telecentric lens used to inspect defects on each side of the component.
The O-Ring dimension measurement was inspired by [3,4,5,6]. Works proposed by [3,4] employed an image processing method to calculate the dimension. Those papers provided a good idea to approximate contours and calculate the length of edge information. In [5], Dokken et al. approximated circular sections by cubic Bézier. Moreover, Lin [6] proposed a method for using the cubic Bézier curve [7] combined with a fourth-order Bézier curve. Goldapp [8] proposed a method for calculating the circular arc control point location using the Bézier curve. The approach proposed in this work is a two-stage solution in which the problem was converted from defect inspection and dimension measurement sites to a single station. The first stage was concerned with defects on the O-Ring’s surface, while the second stage measured the O-Ring dimension. After repeated attempts, we find a 2.5-D defect detection system that can solve the problem we faced easier than the 2-D one. On the other hand, only a few people used defect detection by creating a 2.5D defect-free model. The defect detection method we proposed can detect any object with some trackable path. Then, the algorithm will create a defect-free model. Just only by subtracting two models can be found the approximate location of a defect easily. Furthermore, the photometric stereo method gives further potential for remote monitoring [9] and machine positioning and quality checks [10].
In this paper, we propose a simple O-Ring defect detection system and dimension measurement. The proposed system is described in Section 2, and the proposed experiment flow charts are shown in Figure 1. This paper divide into two-part. One is the defect detection part, We implemented photometric stereo to reconstruct the model with sample surface (e.g., defect-free surface Figure 2a), flow marks (Figure 2b), non-fills (Figure 2c) according to ISO 3601-3:2005 [11]) and compared to optical profilometer (VR-3100, Keyence Co., Osaka, Japan) reconstruct result. Then, develop a defect detection processing and compared result. Second, we compared the algorithm we proposed to raw contours data and Douglas–Peucker algorithm. At first, we calibrate the camera and calculate the homograpy matrix with the camera parameter. Then calculate edge information with different algorithms. Finally, we compare those results with known sample dimension to calculate absolute error. The O-Rings database we collected and evaluated in Section 3. In Section 4, the experiment results and discussion with our database are shown. Furthermore, Section 5 in our conclusion.

2. The Proposed System

2.1. Hardware Architecture

To use the defect detection system to detect surface scratches (e.g., the defect-free surface (Figure 2a), flow marks (Figure 2b), non-fills (Figure 2c) according to ISO 3601-3:2005 [9]), this system provides an industrial camera and six directions of white light sources to implement a photometric stereo to meet the ISO standard (Table 1) [11]. The system provides a complementary metal-oxide semiconductor camera with Basler acA2500-16 um, which has a resolution of 2592 × 1944 and FOV (field of view) of 15 × 11.25 mm2. The hardware architecture of the mechanism is shown in Figure 3a.
The dimension measurement system was used to measure the internal dimension d1 and cross-sectional diameter d2 of the O-Rings [12]. The d1 and d2 are shown in Figure 4. The system provides a CCD camera with Basler acA2500-16 um, which had a resolution of 2592 × 1944 and FOV of 80 × 60 mm. The hardware architecture of the mechanism is shown in Figure 3b.

2.2. Processing of Defect Detection

The photometric stereo method was used to produce the 3D was obtained. Adaptive threshold using sliding windows was employed to attain the final result image IR. The size of the sliding windows was 50 × 50 pixels based on the defect size. The flowchart of this study is shown in Figure 5. We used Figure 3a mechanism with a light source controller (OPT dpa2024e-8) to trigger light source and camera respectively for capture images Ii (i = 1, 2, 3, 4, 5, 6) (Figure 6). The light source of the mechanism came from 6 directions, from light 1 to light 6. We employed those 6-image (Ii, i = 1, 2, 3, 4, 5, 6) to implement a photometric stereo [13] as shown below:
  • Make a binary mask (Figure 7 I6) by using I6. Then, we used this mask to flit background information to reduce background noise effectively.
  • Normalize image by using function (1). Which I(x, y) is a grayscale pixel value at position (x, y) of image.
    I ¯ ( x , y ) i = I ( x , y ) i Max ( I ( x , y ) ) ( i =   1 ,   2 ,   3 ,   4 ,   5 ,   6 )
  • Set a threshold in 100 to binary image Ii (i = 1, 2, 3, 4, 5, 6) (Figure 7) and calculate image moment ( x ¯ ,   y ¯ ) i with images Ii (i = 1, 2, 3, 4, 5, 6) (Figure 7) by function (2).
    ( x ¯ ,   y ¯ ) = ( M 10 M 00 , M 01 M 00 )
  • Define image moment ( x ¯ ,   y ¯ ) 6 as centroid and calculate maximum distance to mask edge r.
    r = Max [ ( x , y ) ( x ¯ ,   y ¯ ) 6 ] when   I ( x ,   y )   >   100
  • Calculate light source direction vectors L using the function (8).
    ( d x , d y ) i = ( x ¯ ,   y ¯ ) i ( x ¯ ,   y ¯ ) 6 ( i =   1 ,   2 ,   3 ,   4 ,   5 ,   6 )
    n i = [ d x i r , d y i r , r 2 d x i 2 d y i 2 r ] ( i =   1 ,   2 ,   3 ,   4 ,   5 ,   6 )
    R = [ 0 ,   0 ,   1 ]
    L i = 2 × ( n i · R ) × n i R ( i =   1 ,   2 ,   3 ,   4 ,   5 ,   6 )
    L = [ L 1 ,   L 2 , L 3 , L 4 , L 5 , L 6 ]
  • Define normal relative surface normal image N by using the function (10).
    I ( x , y ) = [ I ¯ ( x , y ) 1 ,   I ¯ ( x , y ) 2 , I ¯ ( x , y ) 3 , I ¯ ( x , y ) 4 , I ¯ ( x , y ) 5 , I ¯ ( x , y ) 6 ]
    N ( x , y ) = ( L T L ) 1   L T   I ( x , y )
  • Calculate unit vector field N ¯ (Figure 8) by the function (11).
    N ¯ ( x , y ) = N ( x , y ) | | N ( x , y ) | |
  • First, we transfer unit vector field N ¯ to triangle mesh. Then define each vertex point as Pi (i = 0, 1, 2) as function (12). Furthermore, each vertex point’s relative surface normal vector N ¯ i (i = 0, 1, 2). At last, we can define [ N x ,   N y ,   N z ] by using the function (13).
    P i = ( x i ,   y i ,   z i ) ( i = 0 ,   1 ,   2 )
    [ N x ,   N y ,   N z ] = ( N 0 + 2 N 1 + N 2 ) 4
  • Now, we can solve each vertex point’s relative surface normal vector N ¯ i (i = 0, 1, 2) by using the function (14) and unit vector field N ¯ .
    N ¯ i = [ N x = ( y 1 y 0 ) ( z 2 z 0 ) ( z 1 z 0 ) ( y 2 y 0 ) N y = ( z 1 z 0 ) ( x 2 x 0 ) ( x 1 x 0 ) ( y 2 y 0 ) N z = ( x 1 x 0 ) ( y 2 y 0 ) ( y 1 y 0 ) ( x 2 x 0 ) ]
  • The deep of the triangle mesh can be rewritten as an overdetermined set. So, in the image resolution M × N would include 2 ( M 1 ) ( N 1 ) the amount triangle. That is 2 ( M 1 ) ( N 1 ) amount linear equation. Each triangle contains two linear equations as the function (16).
    α = [ ( x 1 x 0 ) ( y 2 y 0 ) ( y 1 y 0 ) ( x 2 x 0 ) ] N z
    N ¯ i = [ α N x = ( y 1 y 0 ) ( z 2 z 0 ) ( z 1 z 0 ) ( y 2 y 0 ) α N y = ( z 1 z 0 ) ( x 2 x 0 ) ( x 1 x 0 ) ( y 2 y 0 ) ]
  • We define A equal all of constant relative with z, and B equal α N x and α N y . Then, we can get the relative height of each pixel Z by using the function (14).
    Z = ( A T A ) 1 A T B
  • At last, we create a 2.5-D model by using the photometric stereo method. The result is shown in Figure 9a. With the photometric stereo method, errors resulting from surface dirt in the inspection process were effectively prevented.
On the other hand, we used the image from button light of defect detection mechanism (I6, Figure 9b) to produce a binary image (Figure 9c). Moreover, this binary image was one of the materials used to produce a smooth surface model MS (Figure 9d).
We generated two factors to produce smooth surface model. One was a binary image of I6 (Figure 9c) and the other one was the photometric stereo model MS. First, we extract contours [14] from Figure 9c. the method of find contour can be explained simply as a curve joining all the continuous points (along the boundary), having same color or intensity. The contours extracted based on chain code 8-connectivity are shown in Figure 10a. then, we used cubic Bézier curve to describe to contours. Before the transformation between contour and cubic Bézier curve. we named all of the control points of the cubic Bézier curve shown in Figure 11. Therefore, we defined the cubic Bézier curve in Equation (18), which we obtained with starting point p00, end point p03, tracking points p30 with corresponding parameter ω, all of ω held values that varied between 0 and 1. Which parameter ω is used to describe cubic Bézier curve. After that, we obtained p01 and p02 using the solution of simultaneous Equation (19). We used the contour start point p00, end point p03, two tracking points p30 with corresponding parameter ω to solute Equation (19). Which tracking points selected by one-third point and two-thirds points of contour points. In Figure 10b, the red points are the cubic Bézier curve’s control points and the green curve is the cubic Bézier curve. In other words, we used the solution of the simultaneous Equation (19) to acquire B1 and B2. Moreover, we acquired the path vector p of the O-Ring by interpolating both B1 and B2.
p30 = (1 − ω)3p00 + 3ω(1 − ω)2p01 + 3ω2(1 − ω)p02 + ω3 p03 ω ∈ [0, 1]
3ω(1 − ω)2p01 + 3ω2(1 − ω)p02 = p30 − (1 − ω)3p00ω3 p03
Secondly, we obtained several vectors of height h (Figure 10c by using the path p as a factor. Thus, we calculated all h to get the result (Figure 10d) by performing a regression analysis. After that, we can acquire a smooth model of the photometric stereo MS (Figure 9d).
We obtained the result of MS by subtracting from the photometric stereo model (Figure 9e). Moreover, we acquired the candidate defect area using sliding windows to eliminate model noise generated in the subtraction process. Furthermore, the candidate defect area is shown in Figure 9f.

2.3. Processing of Dimension Measurement

2.3.1. Pre-Processing of Dimension Measurement

Camera calibration [15] was employed to calculate the homography [16] before the dimension measurement process. The pre-processing flow chat is shown in Figure 12 and the projected relation between the image plane and object plane is shown in Figure 13.
In the camera calibration process, we acquired the camera matrix M, distortion coefficients D, rotation vectors R = (r1, r2, r3), and translation vector t = (tx, ty, tz) using images Ii (i = 1, 2,…, n) (Figure 12b) to calibrate the camera. According to the method proposed in [15,16], we acquired homography H by using Equation (20) and the image used to calculate homography IH (Figure 12c). q is the image plane coordinates and the Q is the object plane coordinate in (20).
[ x y z ] = s M [ r 1 r 2 r 3 t ] [ X Y 0 1 ] s M [ r 1 r 2 t ] [ X Y 1 ] q = H Q w h e r e   H = s M [ r 1 r 2 t ]

2.3.2. Dimension Measurement Processes

The dimension measurement process is shown in Figure 14. This process starts with image I, which is captured by the camera. Then, undistort I (Figure 15a) is acquired using distortion coefficients D and camera matrix M. Finally, the contours [14] (Figure 15c) are acquired using the I binarization image Ib (Figure 15b).
First, we divided the contours into two parts using hierarchy [14]. One was the internal contour (Figure 15c), the other was the external contour. Then, we converted those contours into the cubic Bézier curve. In the beginning of the process, we converted the contour into the Bézier curve, and divided contour C (Figure 15c) into contour Ci (the green line between Figure 15e, red points) using approximate points A (Figure 15d) from the Douglas–Peucker algorithm [17]. The Douglas–Peucker algorithm is shown below:
  • Find the start point PA and end point PB of object contour C (Figure 16a);
  • Connect start point PA and end point PB. Then, find the furthest point PC and calculate the distance D from the point PC to the line P A P B ¯ (Figure 16b).
  • If the distance D from the point PC to the line P A P B ¯ is bigger than the threshold we settled, divide the contour into two parts. Then, calculate the distance D from the point to the line, respectively (Figure 16c).
  • Else if all of the distance D from the point to the line is smaller than the threshold finish the approximate operation.
By using the Douglas–Peucker algorithm, we could ignore the Ib (Figure 15b) edge noise and O-Ring burrs to obtain a perimeter. Though the perimeter was more accurate than the calculated contour, it cost us too much information regarding the real edge. As a result, we proposed a more accurate solution using the cubic Bézier curve to approximate each Ci. We employed Equation (19) to acquire the cubic Bézier control points (Figure 15f) with each Ci and projected control points using homography H [16]. Finally, the arc length was calculated using the Euclidean distance via de Casteljau’s algorithm [18]. The process of the cubic Bézier curve conversion is shown in Figure 17.

3. O-Ring Database

To verify the proposed defect detection method and dimension measure measurement, and we established five databases of O-Rings. Two databases for defect detection and three for dimension measurements were available.

3.1. Database for Defect Detection

3.1.1. DPS (Database of Photometric Stereo Model)

There were 160 defects and 160 non-defects included. The defect samples included 60 samples with flow marks and 100 samples with non-fills and indentations. Each sample had six images Ii (i = 1, 2, 3, 4, 5, 6) to implement the photometric stereo and verify the defect detection process. A sample of this database is shown in Figure 6. There are several different dimensions and cross-section dimension O-Ring samples. The schematic diagram of those samples is shown in Figure 18.
We put O-Rings above the button light source in the defect detection mechanism (Figure 3a). Furthermore, collecting sample images capture by trigger each light source and camera in order. Each sample was collected in the same light parameter, camera parameter. Then, we execute the defect detection we proposed in the same condition with every sample.
In this experiment, we use a light source controller (OPT dpa2024e-8) to modify light intensity in the defect detection system (Figure 2a). Each channel of the light source set on 80. The camera exposure time set on 3000 us. By subtracting the photometric stereo model MP and smooth surface model MS. The deviation model MD was produced. Then we used the 50 × 50 pixels sliding windows and set the threshold on 80 in 8-bit matrix data for the deviation model MD to create defect candidate area. If there are five candidate areas were connected. Then, label the sample as a defect. The threshold and the camera parameter by experiment obtain. Because the photometric stereo method in this paper was based on regression, Which type of method can’t provide accurate relative height, the detection processing is shown in Figure 19.
The reconstruction time consuming is about 30 s and the defect detection time consuming is about 30 s.

3.1.2. DK (Database of Raw Data with Profilometer)

There were 160 defects and 160 non-defects included. The defect samples included 60 samples with flow marks and 100 samples with non-fills and indentations. Each sample was reconstructed using optical profilometer and the reconstruction raw data were acquired. Detailed specification of K optical profilometer is shown in Table 2.
In this experiment, we establish the database with reconstruction raw data in 2.5D format and binary the 2.5D model to get binary image before defect detection. Then, we execute the defect detection we proposed (Figure 5 yellow region). We set the defect depth was 0.08 mm to detect surface defect, which depth is based on ISO standard. The other defect detection condition is same as in the DPS database. The reconstruction time consuming is about 1 min. The defect detection time consuming is about 30 s (Figure 20).

3.2. Database for Dimension Measurement

3.2.1. DVT (Database of the Verified Samples Be Made of T6061)

The standard piece was processed and manufactured with lathe using aluminum alloy (T6061). The products are shown in Figure 13. The standard piece was manufactured for 5 dimensions and 5 pieces for each dimension. Therefore, we had 25 pieces. The dimensions for the manufacturing process were as follows: internal dimension d1 = (5, 10, 15, 20, 25) mm and cross-sectional diameter d2 = 1.78 mm.
To calculate the MAE (Mean Absolute Error) for each O-Ring, we classified the metal O-Ring of each dimension according to the measurement results. The schematic diagram of the metal O-Ring is shown in Figure 21.
We put all of the metal O-Rings above the button light source in the dimension measurement mechanism (Figure 3b). Then, trigger the camera and light source at the same time for each sample to capture images and establish this database. Besides, we used the same measurement parameter to measure each size sample.

3.2.2. DSI (Database of the Standard Sample Regulated by ISO

This database collected a set of samples with dimensions that conformed to ISO 3601-2:2016 [19], ISO16031-1:2002 [20], and ISO16031-2:2003 [21]. All samples were samples defined with the size identification code of the above three specifications. The inside diameters d1, cross-sections d2, and O-Ring tolerances of the size identification code are shown in Table 3.
To calculate the MAE of each size O-Ring, and we put each O-Ring on the measurement platform 30 times repeatedly. This action can provide some deformation. We can measure the algorithm stability by this action. The action schematic diagram is shown in Figure 22. Besides, we used the same measurement parameter to measure each size sample.

3.2.3. DSP (Database of the Standard Sample with External Pressure)

This database included O-Rings with size identification codes from −017 to −020, regulated by the ISO [19,20,21]. We pressured those O-Rings until deformation and fixed them on the object platform. Afterward, we captured all of those O-Ring to establish this database (Table 4). All of measurement conditions and parameter is same with DSI database.

4. Experiment Results and Discussion

4.1. Defection Detection

The DPS result employed in the defect detection process is shown in Table 5 and Figure 23. In Figure 23, We successfully detect a tiny defect. The depth of this defect is 90 μm and in this experiment, we did not have any defects to miss detection. However, there is little amount of false alarm. Because the photometric stereo method in this paper was based on regression, which type of method cannot provide accurate relative height. There are some tiny scratched at the O-Rings surface indeed, but not deep enough to be defective. Those type of sample is shown in Figure 24.
To prove our suppose, which the reason for overkill from regression type photometric stereo. We use optical profilometer to establish the DK database. Then, we set a fixed threshold was 80 μm. In this experiment, we get a pretty good result. The DK result in the defect detection process is shown in Table 6 and Figure 25. This result can prove the processing we proposed was general. To improve reconstruction accuracy can improve the outcome of defect detection. On the other hand, we detect the same tiny defect O-Ring in optical profilometer reconstructed result. It also can successfully detect small defects.

4.2. Dimension Measurement

We compared the Ramer–Douglas–Peucker algorithm result points A and contour C with the method Bp we proposed, all of those points through homography matrix and Euclidean distance to calculate distance. Then calculated the internal and cross-section diameter. On the other hand, we employed the mean absolute error to estimate loss L to evaluate measurement results and stability. The formula of the loss L is shown in Equation (21).
L = Σ(|vds|)/n
The ds was the median size between the maximum allowable dimension and minimum allowable dimension from ISO. The loss L was acquired using the median size ds, which deducted the measurement result v, and the n is the number of the same size O-Ring samples.
The DVT measurement results of internal and cross-section diameters are shown in Figure 26a,b. Moreover, the DSI measurement results of internal and cross-section diameters are shown in Figure 26c,d. In addition, the DSP measurement results for the internal and cross-section diameters are shown in Figure 26e,f. All of the results display our processing can improve measurement result.
In those results, we can prove that the method we proposed can further improve the measurement error from edge protrusions. The detailed comparison is shown in Figure 27. There is some small noise at the O-Ring edge (Figure 27a). To improve the measurement, we ignore those protrusions using Ramer–Douglas–Peucker algorithm (Figure 27b). However, this method could lose the real edge of O-Ring too much from very large threshold. Such as the blue line and green line in Figure 27b, both lines were the measurement result using Ramer–Douglas–Peucker algorithm. Moreover, if we set the threshold too small, the algorithm loses the ability to ignore edge protrusions.
To further reduce measurement error, we proposed a new edge extracting algorithm in Section 2. This algorithm using a large threshold in Ramer–Douglas–Peucker algorithm. We fitted each contour C between every two points A by using the cubic Bézier curve. The cubic Bézier curve is shown in Figure 27c. In Figure 27c, red points are Ramer–Douglas–Peucker algorithm result points and cubic Bézier control points p00 and p03, and green points are cubic Bézier control points p01 and p02 by Equation (19) and the yellow curve was the fitting result of our cubic Bézier fitting algorithm.
Thus, we can ignore edge protrusions and guarantee real edge information be keeping. Then, we use homography to calculate dimension.
To verify measurement stability, we used the STD (standard deviation) as an index for measurement stability. The measurement results of d1 and d2 are shown in Table 7 and Table 8. This result proves the measurement processing we proposed is the most stable in those three algorithms. On the other hand, most of the time consumed in measurement processing was homography projective and Euclidean distance calculation. Our algorithm’s result points were extracting by de Casteljau’s algorithm. In de Casteljau’s algorithm, we can reduce extracted resolution to reduce the total measurement time. So the time consuming is less than the contour method.

5. Conclusions

We developed an affordable AOI system for O-Ring inspection and dimension measurement. The total cost of the system we proposed is only $1500 USD. The system not only achieved a 100% recall rate, but the accuracy reached 95.56% in the collected dataset. We also detected some defects were not yet regulated by the ISO [9]. Meanwhile, we effectively avoided the false negative state caused by surface dirt. To detect of each O-Ring only take 30 s because the detect algorithm is based on 2-D data format. On the other hand, the smooth model produced by the detect algorithm can be establishing a deep learning database. We also successfully detected the oxidized defection, which ISO didn’t mention. The rubber oxidized model is shown in Figure 28.
Alternatively, we proposed a new measurement method. The algorithm we proposed was experimentally verified to be more accurate, more stable, and faster. The algorithm method improves the Ramer–Douglas–Peucker algorithm real edge lose problem and keep the real edge information at the same time. Moreover, this algorithm time consuming can be reduced using de Casteljau’s algorithm-extracting resolution.

Author Contributions

Conceptualization, C.-C.H. and F.-S.Y.; methodology, C.-C.H. and F.-S.Y.; software, F.-S.Y.; validation, C.-C.H. and F.-S.Y.; formal analysis, C.-C.H. and L.-C.C.; investigation, C.-C.H. and L.-C.C.; resources, C.-C.H.; data curation, F.-S.Y.; writing—original draft preparation, F.-S.Y.; writing—review and editing, C.-C.H.; visualization, C.-C.H.; supervision, C.-C.H.; project administration, C.-C.H.; funding acquisition, C.-C.H. All authors have read and agreed to the published version of the manuscript.

Funding

This article is for the Ministry of Science and Technology, Taiwan, grant number 107-2628-E-027-002-MY3 and 109-2622-E-027-016-CC3, thanks to the support of the Ministry of Science and Technology, Taiwan.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Conflicts of Interest

This research received no external funding.

References

  1. Peng, G.; Zhang, Z.; Li, W. Computer vision algorithm for measurement and inspection of O-Rings. Measurement 2016, 94, 828–836. [Google Scholar] [CrossRef]
  2. Ho, C.-C.; Lu, J.-J.; Li, P.-C. Development of auto defect inspection system for cell phone silicone rubber gasket. In Proceedings of the 10th International Symposium on Precision Engineering Measurements and Instrumentation (ISPEMI 2018), Kunming, China, 8–10 August 2018. [Google Scholar]
  3. Husmann, T.; Kreimeier, D. Measurement of radial-axial rolled rings by using image processing and thermography. In Key Engineering Materials; Trans Tech Publ.: Stafa, Switzerland, 2015; pp. 278–283. [Google Scholar]
  4. Husmann, S.; Husmann, T.; Meier, H. Measurement of rings via image processing during and after radial-axial ring rolling. In Applied Mechanics and Materials; Trans Tech Publ.: Stafa, Switzerland, 2015; pp. 136–143. [Google Scholar]
  5. Dokken, T.; Dæhlen, M.; Lyche, T.; Mørken, K. Good approximation of circles by curvature-continuous Bézier curves. Comput. Aided Geom. Des. 1990, 7, 33–41. [Google Scholar] [CrossRef]
  6. Lin, J.-F. Use of Cubic Bézier Curve Approximation of Fourth-Order Bézier Curve. Master’s Thesis, National Chung Cheng University, Chiayi, Taiwan, 2012. [Google Scholar]
  7. Bézier, P. Courbes et surfaces pour la CFAO. Tech. l’Ingénieur 1992, A1440, 1–18. [Google Scholar]
  8. Goldapp, M. Approximation of circular arcs by cubic polynomials. Comput. Aided Geom. Des. 1991, 8, 227–238. [Google Scholar] [CrossRef]
  9. Urbikain, G.; Alvarez, A.; López de Lacalle, L.N.; Arsuaga, M.; Alonso, M.A.; Veiga, F. A reliable turning process by the early use of a deep simulation model at several manufacturing stages. Machines 2017, 5, 15. [Google Scholar] [CrossRef]
  10. Urbikain, G.; Perez, J.M.; López de Lacalle, L.N.; Andueza, A. Combination of friction drilling and form tapping processes on dissimilar materials for making nutless joints. Proc. Inst. Mech. Eng. Part B J. Eng. Manuf. 2018, 232, 1007–1020. [Google Scholar] [CrossRef]
  11. Fluid Power Systems—O-Rings—Part 3: Quality Acceptance Criteria; ISO 3601-3:2005; International Organization for Standardization: Geneva, Switzerland, 2005.
  12. Fluid Power Systems—O-Rings—Part 1: Inside Diameters, Cross-Sections, Tolerances and Designation Codes; ISO 3601-1:2012; International Organization for Standardization: Geneva, Switzerland, 2012.
  13. Zhang, J. A New 3D Reconstruction Algorithm Based on Photometric Stereo. Master’s Thesis, Northwestern Polytechnical University, Shaanxi, China, 2004. [Google Scholar]
  14. Suzuki, S. Topological structural analysis of digitized binary images by border following. Comput. Vis. Graph. Image Process. 1985, 30, 32–46. [Google Scholar] [CrossRef]
  15. Din, I.; Anwar, H.; Syed, I.; Zafar, H.; Hasan, L. Projector calibration for pattern projection systems. J. Appl. Res. Technol. 2014, 12, 80–86. [Google Scholar] [CrossRef] [Green Version]
  16. Dubrofsky, E. Homography Estimation. Ph.D. Thesis, The University of British Columbia, Kelowna, BC, Canada, 2009. [Google Scholar]
  17. Douglas, D.H.; Peucker, T.K. Algorithms for the reduction of the number of points required to represent a digitized line or its caricature. Cartogr. Int. J. Geogr. Inf. Geovisualization 1973, 10, 112–122. [Google Scholar] [CrossRef] [Green Version]
  18. Boehm, W.; Müller, A. On de Casteljau’s algorithm. Comput. Aided Geom. Des. 1999, 16, 587–605. [Google Scholar] [CrossRef]
  19. Fluid Power Systems—O-Rings—Part 2: Housing Dimensions for General Applications; ISO 3601-2:2016; International Organization for Standardization: Geneva, Switzerland, 2016.
  20. Aerospace Fluid Systems—O-Rings, Inch Series: Inside Diameters and Cross Sections, Tolerances and Size-Identification Codes—Part 1: Close Tolerances for Hydraulic Systems ISO; ISO 16031-1:2002; International Organization for Standardization: Geneva, Switzerland, 2002.
  21. Aerospace Fluid Systems—O-Rings, Inch Series: Inside Diameters and Cross-Sections, Tolerances and Size-Identification Codes—Part 2: Standard Tolerances for Non-Hydraulic Systems; ISO 16031-2:2003; International Organization for Standardization: Geneva, Switzerland, 2003.
Figure 1. The proposed experiment in this paper. (a) O-Rings defect detection experiment flowchart; (b) O-Rings dimension measurement flowchart.
Figure 1. The proposed experiment in this paper. (a) O-Rings defect detection experiment flowchart; (b) O-Rings dimension measurement flowchart.
Applsci 11 02601 g001aApplsci 11 02601 g001b
Figure 2. (a) Sample without defects; (b) sample with flow marks; (c) sample with non-fills.
Figure 2. (a) Sample without defects; (b) sample with flow marks; (c) sample with non-fills.
Applsci 11 02601 g002
Figure 3. There are two mechanisms in this paper: (a) Defect detection system; (b) dimension measurement system.
Figure 3. There are two mechanisms in this paper: (a) Defect detection system; (b) dimension measurement system.
Applsci 11 02601 g003
Figure 4. Schematic diagram of O-Ring dimension.
Figure 4. Schematic diagram of O-Ring dimension.
Applsci 11 02601 g004
Figure 5. Flowchart of the O-Rings defect detection process. The green region is image capture relative processing and the yellow region is defect detection relative processing. Which MP and I6 replace with result of optical profilometer reconstruction when the verification stage.
Figure 5. Flowchart of the O-Rings defect detection process. The green region is image capture relative processing and the yellow region is defect detection relative processing. Which MP and I6 replace with result of optical profilometer reconstruction when the verification stage.
Applsci 11 02601 g005
Figure 6. Images Ii (i = 1,2,3,4,5,6) from the camera of defection detection system capture.
Figure 6. Images Ii (i = 1,2,3,4,5,6) from the camera of defection detection system capture.
Applsci 11 02601 g006
Figure 7. A set images Ii (i = 1,2,3,4,5,6) without background information.
Figure 7. A set images Ii (i = 1,2,3,4,5,6) without background information.
Applsci 11 02601 g007
Figure 8. Unit vector field N ¯ by using function (11).
Figure 8. Unit vector field N ¯ by using function (11).
Applsci 11 02601 g008
Figure 9. Each stage output of defect detection processing: (a) Model of photometric stereo produce; (b) I6, this image capture with the button light source in defect detection mechanism (Figure 3); (c) binarization and inverse image of (b); (d) smooth model MS, created by Figure 5; (e) result of (d) subtracted from (e); (f) candidate defect area, which create by sliding windows.
Figure 9. Each stage output of defect detection processing: (a) Model of photometric stereo produce; (b) I6, this image capture with the button light source in defect detection mechanism (Figure 3); (c) binarization and inverse image of (b); (d) smooth model MS, created by Figure 5; (e) result of (d) subtracted from (e); (f) candidate defect area, which create by sliding windows.
Applsci 11 02601 g009
Figure 10. Each stage output of create smooth model processing: (a) Contour of I6 binarization, external contour C1, and internal contour C2; (b) Bézier curve and control points B1 converted by C1 and Bézier curve/control points B2 converted by C2; (c) path p of interpolated between B1 and B2; (d) height vector h above pi and regression analysis result of h .
Figure 10. Each stage output of create smooth model processing: (a) Contour of I6 binarization, external contour C1, and internal contour C2; (b) Bézier curve and control points B1 converted by C1 and Bézier curve/control points B2 converted by C2; (c) path p of interpolated between B1 and B2; (d) height vector h above pi and regression analysis result of h .
Applsci 11 02601 g010
Figure 11. Control points of the cubic Bézier curve.
Figure 11. Control points of the cubic Bézier curve.
Applsci 11 02601 g011
Figure 12. (a) Flowchart of pre-processing the dimension measurement; (b) images for camera calibration Ii; (c) image for calculating homography IH.
Figure 12. (a) Flowchart of pre-processing the dimension measurement; (b) images for camera calibration Ii; (c) image for calculating homography IH.
Applsci 11 02601 g012
Figure 13. The schematic diagram of projected relation between the image plane and object plane in measurement mechanism (Figure 3b).
Figure 13. The schematic diagram of projected relation between the image plane and object plane in measurement mechanism (Figure 3b).
Applsci 11 02601 g013
Figure 14. Flowchart of the dimension measurement.
Figure 14. Flowchart of the dimension measurement.
Applsci 11 02601 g014
Figure 15. Each stage output of dimension measurement processing: (a) The image I from camera capture; (b) the binarization and inverse image Ib; (c) internal contour of the O-Ring; (d) approximate points A ; (e) schematic diagram of the divided contour; (f) result of the converted cubic Bézier control points.
Figure 15. Each stage output of dimension measurement processing: (a) The image I from camera capture; (b) the binarization and inverse image Ib; (c) internal contour of the O-Ring; (d) approximate points A ; (e) schematic diagram of the divided contour; (f) result of the converted cubic Bézier control points.
Applsci 11 02601 g015aApplsci 11 02601 g015b
Figure 16. Schematic diagram of Douglas–Peucker algorithm: (a) A set of contour points and start point PA and end point PB; (b) Connect start point PA and end point PB. Then, find the furthest point PC and calculate the distance D from the point PC to the line P A P B ¯ ; (c) If the distance D from the point PC to the line P A P B ¯ is bigger than the threshold we settled, divide the contour into two parts. Then, calculate the distance D from the point to the line, respectively; (d) Else if all of the distance D from the point to the line is smaller than the threshold finish the approximate operation.
Figure 16. Schematic diagram of Douglas–Peucker algorithm: (a) A set of contour points and start point PA and end point PB; (b) Connect start point PA and end point PB. Then, find the furthest point PC and calculate the distance D from the point PC to the line P A P B ¯ ; (c) If the distance D from the point PC to the line P A P B ¯ is bigger than the threshold we settled, divide the contour into two parts. Then, calculate the distance D from the point to the line, respectively; (d) Else if all of the distance D from the point to the line is smaller than the threshold finish the approximate operation.
Applsci 11 02601 g016aApplsci 11 02601 g016b
Figure 17. Flowchart of the contour converted the Bézier curve.
Figure 17. Flowchart of the contour converted the Bézier curve.
Applsci 11 02601 g017
Figure 18. The schematic diagram of DPS samples. Each row is a set of sample capture with six light sources. The last row is a sample of non-defect.
Figure 18. The schematic diagram of DPS samples. Each row is a set of sample capture with six light sources. The last row is a sample of non-defect.
Applsci 11 02601 g018
Figure 19. Defects detection processing with photometric stereo model MP. (a) Photometric stereo model MP (Gray scale), those models reconstructed by corresponding images in Figure 18; (b) Smooth surface model MS (Gray scale), this model is the smooth version of Photometric stereo model MP, create by the method in this paper Section 2.2; (c) the deviation model MD, this model created by subtracting (a,b) (jet color map and mapped into range 0~500 μm); (d) Candidate area (Binary images), which is produced by sliding windows with (c).
Figure 19. Defects detection processing with photometric stereo model MP. (a) Photometric stereo model MP (Gray scale), those models reconstructed by corresponding images in Figure 18; (b) Smooth surface model MS (Gray scale), this model is the smooth version of Photometric stereo model MP, create by the method in this paper Section 2.2; (c) the deviation model MD, this model created by subtracting (a,b) (jet color map and mapped into range 0~500 μm); (d) Candidate area (Binary images), which is produced by sliding windows with (c).
Applsci 11 02601 g019
Figure 20. Defect detection processing with optical profilometer. (a) Model of optical profilometer reconstructed (Gray scale); (b) Smooth surface model MS (Gray scale), this model is the smooth version of (a), create by the method in this paper Section 2.2; (c) The deviation model MD, this model created by subtracting (a,b) (jet color map and mapped into range 0~500 μm); (d) Candidate area (Binary images), which is produced by sliding windows with (c).
Figure 20. Defect detection processing with optical profilometer. (a) Model of optical profilometer reconstructed (Gray scale); (b) Smooth surface model MS (Gray scale), this model is the smooth version of (a), create by the method in this paper Section 2.2; (c) The deviation model MD, this model created by subtracting (a,b) (jet color map and mapped into range 0~500 μm); (d) Candidate area (Binary images), which is produced by sliding windows with (c).
Applsci 11 02601 g020
Figure 21. (a) CAD of the metal O-Rings; (b) metal O-Ring image (top light source); (c) metal O-Ring image (backlight source).
Figure 21. (a) CAD of the metal O-Rings; (b) metal O-Ring image (top light source); (c) metal O-Ring image (backlight source).
Applsci 11 02601 g021aApplsci 11 02601 g021b
Figure 22. Schematic diagram of the O-Ring repeatedly on the object plane.
Figure 22. Schematic diagram of the O-Ring repeatedly on the object plane.
Applsci 11 02601 g022
Figure 23. A tiny defect on the O-Ring’s surface (a) Model of photometric stereo produce MP; (b) smooth model MS; (c) subtracting result on defect candidate area.
Figure 23. A tiny defect on the O-Ring’s surface (a) Model of photometric stereo produce MP; (b) smooth model MS; (c) subtracting result on defect candidate area.
Applsci 11 02601 g023
Figure 24. O-Ring sample with the tiny scratched measured by optical profilometer. (a) 3D model of the tiny scratched; (b) 2D image of the tiny scratched; (c) Measurement result of the tiny scratched.
Figure 24. O-Ring sample with the tiny scratched measured by optical profilometer. (a) 3D model of the tiny scratched; (b) 2D image of the tiny scratched; (c) Measurement result of the tiny scratched.
Applsci 11 02601 g024
Figure 25. (a) optical profilometer model; (b) smooth model MS; (c) subtracting result on defect candidate area.
Figure 25. (a) optical profilometer model; (b) smooth model MS; (c) subtracting result on defect candidate area.
Applsci 11 02601 g025
Figure 26. (a) Result of d1 measurement with DVT; (b) result of d2 measurement with DVT; (c) result of d1 measurement with DSI; (d) result of d2 measurement with DSI; (e) result of d1 measurement with DSP; (f) result of d2 measurement with DSP.
Figure 26. (a) Result of d1 measurement with DVT; (b) result of d2 measurement with DVT; (c) result of d1 measurement with DSI; (d) result of d2 measurement with DSI; (e) result of d1 measurement with DSP; (f) result of d2 measurement with DSP.
Applsci 11 02601 g026aApplsci 11 02601 g026bApplsci 11 02601 g026c
Figure 27. (a) Schematic diagram of the edge of contour with noise and protrusions; (b) Schematic diagram of approximate points with loss information by Ramer–Douglas–Peucker algorithm in large threshold. The red points are the algorithm result points, and the green and blue lines represent internal edge-tracking result and external edge tracking result; (c) Schematic diagram of fitting results found using cubic Bézier curves. which green points are cubic Bézier control points p01 and p02 by Equation (19). The yellow curve was the fitting result of our cubic Bézier fitting algorithm.
Figure 27. (a) Schematic diagram of the edge of contour with noise and protrusions; (b) Schematic diagram of approximate points with loss information by Ramer–Douglas–Peucker algorithm in large threshold. The red points are the algorithm result points, and the green and blue lines represent internal edge-tracking result and external edge tracking result; (c) Schematic diagram of fitting results found using cubic Bézier curves. which green points are cubic Bézier control points p01 and p02 by Equation (19). The yellow curve was the fitting result of our cubic Bézier fitting algorithm.
Applsci 11 02601 g027
Figure 28. (a) Image of the rubber oxidized model; (b) rubber oxidized model (top view); (c) rubber oxidized model (perspective view).
Figure 28. (a) Image of the rubber oxidized model; (b) rubber oxidized model (top view); (c) rubber oxidized model (perspective view).
Applsci 11 02601 g028aApplsci 11 02601 g028b
Table 1. ISO 3601-3:2005 O-Ring quality acceptance criteria [9].
Table 1. ISO 3601-3:2005 O-Ring quality acceptance criteria [9].
Limits of Size for Surface Imperfections for Grade N O-Rings
Surface Imperfection TypeDiagrammatic RepresentationLimiting DimensionsMaximum Limits of Imperfections
Grade N O-Rings
Cross-Section, d2
>0.8
≤2.25
>2.25
≤3.15
>3.15
≤4.50
>4.50
≤6.30
>6.30
≤8.40
Excessive trimming (radial tool marks not allowed) Applsci 11 02601 i001nTrimming is allowed provided the dimension n is not reduced below the minimum diameter d2 for the O-Ring.
Flow marks (radial orientation of flow marks is not permissible) Applsci 11 02601 i002v1.501.506.506.506.50
k0.080.080.080.080.08
Non-fills and indentations (including parting line indentations) Applsci 11 02601 i003w0.600.801.001.301.70
t0.080.080.080.100.13
Table 2. Specification of optical profilometer VR-3100.
Table 2. Specification of optical profilometer VR-3100.
NameSpecification and Parameter
Trademark and modelVR-3100
Magnification12×
FOV(field of view)24 × 18 mm2
Resolution1024 × 768
Working distance75 mm
Pixel size23.4375 × 23.4375 m2
Repeatability (Vertical)0.5 μm
Repeatability (horizontal)1 μm
Table 3. Inside diameters, cross-sections, and tolerances for O-Rings.
Table 3. Inside diameters, cross-sections, and tolerances for O-Rings.
SIC (Size Identification Code)Internal Diameter d1 (mm)Cross-Section d2 (mm)
Min.Max.Min.Max.
−0052.442.691.701.85
−0062.773.021.701.85
−0073.563.811.701.85
−0084.344.601.701.85
−0095.165.411.701.85
−0105.946.201.701.85
−0117.527.771.701.85
−0129.129.371.701.85
−01310.6910.951.701.85
−01412.2912.551.701.85
−01513.8714.121.701.85
−01615.4715.721.701.85
−01717.0417.301.701.85
−01818.6418.901.701.85
−01920.1920.501.701.85
−02021.7922.101.701.85
−02123.3623.671.701.85
−02224.9725.271.701.85
−02326.5426.851.701.85
Table 4. Table of DPS (database of photometric stereo model) with SIC (size identification code) and image index.
Table 4. Table of DPS (database of photometric stereo model) with SIC (size identification code) and image index.
Image Index
123
SIC−017 Applsci 11 02601 i004 Applsci 11 02601 i005 Applsci 11 02601 i006
−018 Applsci 11 02601 i007 Applsci 11 02601 i008 Applsci 11 02601 i009
−019 Applsci 11 02601 i010 Applsci 11 02601 i011 Applsci 11 02601 i012
−020 Applsci 11 02601 i013 Applsci 11 02601 i014 Applsci 11 02601 i015
Table 5. Confusion matrix of the defect result with DPS.
Table 5. Confusion matrix of the defect result with DPS.
True Condition
PositiveNegative
Predicted OutcomePositive16011
Negative0149
Accuracy96.56%
Precision93.57%
Recall100%
Table 6. Confusion matrix of the defect result with DK.
Table 6. Confusion matrix of the defect result with DK.
True Condition
PositiveNegative
Predicted OutcomePositive1600
Negative0160
Accuracy100%
Precision100%
Recall100%
Table 7. Table of the internal diameter measurement result via STD.
Table 7. Table of the internal diameter measurement result via STD.
Unit: mmMethods of Measurement
Name of DatabaseBpAC
DVT0.014010.046270.47170
DSI0.046060.077640.48437
DSP0.037030.139720.87662
Table 8. Table of cross-section diameter measurement result via STD.
Table 8. Table of cross-section diameter measurement result via STD.
Unit: mmMethods of Measurement
Name of DatabaseBpAC
DVT0.007410.016570.03544
DSI0.034240.045910.05424
DSP0.026970.041450.29591
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Share and Cite

MDPI and ACS Style

Yang, F.-S.; Ho, C.-C.; Chen, L.-C. Automated Optical Inspection System for O-Ring Based on Photometric Stereo and Machine Vision. Appl. Sci. 2021, 11, 2601. https://doi.org/10.3390/app11062601

AMA Style

Yang F-S, Ho C-C, Chen L-C. Automated Optical Inspection System for O-Ring Based on Photometric Stereo and Machine Vision. Applied Sciences. 2021; 11(6):2601. https://doi.org/10.3390/app11062601

Chicago/Turabian Style

Yang, Fu-Sheng, Chao-Ching Ho, and Liang-Chia Chen. 2021. "Automated Optical Inspection System for O-Ring Based on Photometric Stereo and Machine Vision" Applied Sciences 11, no. 6: 2601. https://doi.org/10.3390/app11062601

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop