SUN Ying, FU Lu-hua, WANG Zhong
(State Key Laboratory of Precision Measuring Technology and Instruments,Tianjin University,Tianjin 300072,China)
Abstract: A ceramic ball is a basic part widely used in precision bearings. There is no perfect testing equipment for ceramic ball surface defects at present. A fast visual detection algorithm for ceramic ball surface defects based on fringe reflection is designed. By means of image preprocessing, grayscale value accumulative differential positioning, edge detection, pixel-value row difference and template matching, the algorithm can locate feature points and judge whether the spherical surface has defects by the number of points. Taking black silicon nitride ceramic balls with a diameter of 6.35 mm as an example, the defect detection time for a single gray scale image is 0.78 s, and the detection limit is 16.5 μm.
Key words: ceramic ball; surface defect; fringe reflection; visual detection algorithm
Rolling bearings are widely used in aerospace engines, underwater bearings, precision machine tools and other instruments due to their excellent compromise in cost, size, weight, load carrying capacity, durability, precision and friction[1]. With the rapid development of modern industry, precision instruments are required to work stably under high temperature, high pressure and corrosive conditions. Thus, higher requirements are demanded for rolling bearing quality. The performance and lifespan of a rolling bearing are directly determined by rolling elements. Compared with traditional metal rolling elements, ceramic balls have lower density, better rigidity, higher hardness and smaller thermal expansion coefficient. These excellent properties make them gradually become the basic parts of rolling bearings, ensuring high-speed and smooth running of bearings in extreme environments.
Ceramic ball surface defects will reduce the reliability of a rolling bearing, especially when it works under extreme conditions. The surface defects will seriously affect the bearing accuracy and comprehensive performance, resulting in early fatigue failure[2]. Since ceramics are brittle and the formation mechanism of ceramic ball surface defects is complex, based on the current state-of-the-art, it is impossible to eliminate accidental surface defects generated by processing in principle completely[3]. Therefore, to avoid damage to the performance caused by surface defects, the finished ceramic products must be nondestructively tested. With the increasing demand for ceramic balls in industry, detecting ceramic ball surface defects accurately and quickly becomes necessary and urgent.
However, it is not easy to detect ceramic ball surface defects precisely and rapidly due to the following reasons.
1) There are many kinds of surface defects of ceramic balls, such as cracks, pits, smears, scratches, etc. As shown in Fig.1, they vary in size and shape, which makes it difficult to set a standard for detecting defects.
Fig.1 Different kinds of ceramic ball surface defects
2) Compared with the traditional metal bearing ball, the difference between the grayscale value of the defective area and the nondefective area on a ceramic ball surface is small. Some kinds of ceramic ball surface defects are small in size, the maximum length of which is less than 20 mm. All these above mean that the contrast between the surface defects and the nondefective areas of ceramic balls is significantly lower than that of metal balls.
3) Unlike metal materials, most kinds of ceramic materials cannot be electromagnetically detected as they are non-magnetic and non-conductive.
4) Some types of ceramic bearing balls are less than 10 mm in diameter, small in size and large in curvature.
At present, there is no surface quality evaluation standard and mature online surface defect detection system. Most factories still rely on manual vision to test ceramic balls whose detection accuracy is only 80%[3].
With a three-dimensional high-resolution industrial X-CT, Wang et al.[4]developed a method to detect surface defects for ceramic ball blank. It is costly and time-consuming, not applicable for online detection. Li et al.[5]inspected ceramic ball surfaces through automatic high-precision fluorescence penetration. It is limited from wide use due to its complex process. The United States Argonne laboratory[6]developed a laser scattering inspection system for ceramic parts whose resolution is up to 10 μm. However, it is too slow for on-site detection. Petitet et al.[7]designed a system to test silicon nitride ceramic bearing balls based on high-frequency ultrasonic, only effective for C-cracks.
Recently, the costs of industrial cameras and LED light sources have been reduced gradually, and the precision of machine vision inspection systems[8]becomes higher and higher, which provides a new idea for the online nondestructive testing of ceramic ball surface defects. There are also some related researches. A US patent in 2011[9]made a visual inspection device for surface defects of ceramic balls in kerosene, effectively isolating the interference of airborne dust. But image quality, cost and whether it is feasible are not mentioned. Yang et al.[3]utilized a microscope to identify defects by grayscale differences. While constrained by the lens type, the system can only measure ceramic balls with a diameter of 10-14 mm. As mentioned above, many ceramic ball bearings are small with the diameters less than 10 mm. For the balls with such size, the detection system will fail to image limited by the field depth of a microscope.
Through experiments, our research team found that the conventional detection methods for rolling elements made by mental, that is, detecting defects by grayscale difference, cannot be applied to ceramic balls. For most of their defects are small and have low contrasts with the undefective areas. Our research group tried to do the inspection depending on fringe reflection[10], which is a typical spatial surface topography modulation method, able to highlight the defects on ceramic ball surfaces.
Conventional surface modulation method[11]usually projects uniform flat fringes to an object. However, when the measured object is spherical, falt fringes are distorted, as shown in Fig.2. Some areas of the image are densely fringed, excessively overlapping and blurred, while other areas are sparsely fringed, reducing the number of effective fringes for detection and increasing miss detection rate. Moreover, the fringe shape is complex on the ball surface, resulting in high complexity of image processing algorithms.
Fig.2 An image obtained by projecting uniform straight fringes onto a spherical surface
To ensure the evenness of fringes on the ceramic ball surface, a fringe pattern drawn according to the precise reverse path trace[12]was used to help ceramic ball surface defects detection. The process for getting this fringe pattern will be briefly intoduced in section 2 to make the algorithm complete.
Fig.3 shows the fringe patterns used in we and a photo of ceramic ball surface with such fringe patterns projected on it.
Based on fringe reflection, we further study the visual defect detection algorithm. The algorithm can locate a ceramic ball and its surface defects accurately and quickly, and count the number of feature points. The remainder of this paper is arranged as follows. In section 1, the visual inspection algorithm is introduced. The experiment and results are given in section 2. Finally, the conclusions are drawn in section 3.
Fig.3 Reflective fringes and photo of ceramic ball
The goal of the visual defect detection algorithm is to find the image features related to the surface quality of the ceramic ball and to output the quantitative information as the basis for judging whether there is a defect. The main steps of the defect detection algorithm designed include automatic detection area location, edge detection, row difference and template matching. To make the algorithm complete, the process for getting fringe patterns is briefly intoduced firstly.
By tracing the ray reversely, the mathematical model of the points on the reflection fringe can be determined. While the position relationship of reflection fringes layout is known, the coordinates of these points can be calculated, and the reflection fringes can be drawn by connecting these points smoothly.
Fig.4 is the layout of the reflection fringes configuration. The center of the ceramic ball, the lens center, and the camera screen center are collinear. The fringe projection screen is perpendicular to the plane on which the ceramic ball is placed. As shown in Fig.4,ais the distance between the camera’s image plane and the lens center,bis the distance between the lens center andρthe vertex on the ceramic ball, andis the vertical distance from the ball center to the projection screen.
Define the vertex of the ball as the origin, the normal direction of the fringe projection screen asxdirection, the line direction between the lens center and the ball vertex aszdirection, the Cartesian coordinate system can be established according to the right-hand rule. Fig.5 is the position relationship diagram of the ceramic ball and the screen viewed from the top along thezdirecton.
Fig.4 Layout of reflection fringes configuration
Fig.5 Top view of relationship between ceramic ball and screen position
As shown in Fig.4,P3is a point on the projection screen, the light ray fromP3intersects the ceramic ball surface at pointP2, andP1is the image point ofP2on the camera’s image plane. Tracking the light ray back, the positions of the points on the project screen can be deduced according to their corresponding points on the image plane.
In Fig.4, the coordinates ofP1are (x1,y1,-a-b), which will be preset as needed; the coordinates of the lens center areP(0,0,-b) and the coordinates of the intersection pointP2are (x2,y2,z2); and the coordinates ofP3are (x3,y3,z3). Based on pinhole imaging model, we get the coordinate ofP2from the coordinates ofP1andPas
(1)
According to the reflection theorem, the line vector corresponding to the reflected light can be calculated by
R=I-2I×N×N=(Rx,Ry,Rz).
(2)
The unit incident vector ofP2satisfies
I=(-x1,-y1,a),
(3)
whereIis the unit incident vector,Nis the unit normal vector on the ceramic ball surface, andRis the unit incident vector.
The unit normal vector at the surface point satisfies
(4)
wheref(x,y,z) satisfies
f(x,y,z)=z2-2rz+x2+y2,
(5)
where the ceramic sphere is considered as an ideal sphere, andris the radius of the ceramic ball.
According to Eq.(2) and the coordinates ofP2, the normal vectorRof the incident light ofP2is obtained by
(6)
The direction vector ofRis given by
(7)
According to Eq.(7) and the coordinates ofP2,P3is obtained as
x3=-ρ,
(8)
The corresponding point on the screen of each point of the straight-line fringe on camera’s imaging palne can be eparately calculated respectively, which can be connected smoothly to get the fringe pattern, as shown in Fig.3 (a) (the coordinate unit is mm).
To meet the need for online detections, we designed the image processing algorithm with the function to automatically locate the region of interest(ROI). The ROI in this paper is the fringe projection area on the ceramic sphere surface.
Fig.6 is the photo captured by an industrial camera. Fig.7 is the gray histogram of Fig.6. The grayscale distribution of the fringe area and the background area in Fig.6 are similar, which means it is impossible to get a binary image with a fixed threshold and locate the effective detection area. The grayscale value of the dark area below the fringe area of Fig.7 concentrated near 30 and its frequency is significantly larger than that of other regions. Therefore the ROI can be located through the dark area.
Fig.6 Original image
Fig.7 Gray histogram of Fig.4
In order to highlight the dark areas below the fringes, a gray scale curve is designed as
(9)
This mapping stretches the original image pixel points with a clipping square map when their gray levels are betweenaandb(In Fig.6,aequals 27 andbequals 255). Fig.8 is the highlighted dark region image after grayscale transformation.
After grayscale transformation, we search four boundaries of the dark area in Fig.8 by grayscale value accumulative difference, which is more flexible than finding boundaries through fixed coordinate values.
Fig.8 Image after grayscale transformation
Fig.9 is the digital image coordinate system defined in this algorithm. Accumulating gray values of pixels with the same abscissa values in Fig.8, we can obtain the horizontal grayscale value accumulation which is recorded asXi; Similarly, accumulating gray values of the pixels with the same ordinate values, we can obtain the vertical grayscale value accumulation, which is recorded asYj, namely
(10)
Fig.9 Digital image coordinate system
Fig.10 Grayscale value accumulation curves
Fig.10(a) and Fig.10(b) are the horizontal and vertical grayscale value accumulation curves of Fig.8. Since the gray value of the dark area in Fig.8 is lower than that of the background, the two curves are flat on both sides and recessed in the middle. The point where the value in the curve begins to decrease sharply corresponds to the boundary of the dark area. The forward horizontal and vertical grayscale value accumulative differential results are recorded as
ΔXi=Xi-Xi-1,
ΔYj=Yj-Yj-1.
(11)
The two curves are shown in Fig.11(a) and Fig.11(b).
Fig.11 Grayscale value accumulative difference curves
Setting appropriate forward differential thresholds, we can determine the rectangular boundary of the dark area. Fig.12 is the result.
Fig.12 Positioning result
By observing the original image, we can find the dark area and the fringe area satisfy a fixed positional relationship. The upper and lower boundaries in Fig.12 can be used to locate the fringe region. The positioning result in Fig.13 is the effective detection region in this paper.
Fig.13 Positioning result of fringe region
The algorithm designed in this paper utilizes histogram equalization to preprocess the image before edge detection, enhancing the contrast of the fringe region. Fig.14 is the result.
Fig.14 Fringe region after histogram equalization
We use the Canny edge detector[13]to find edges of the fringe regions. For edge detection, the Gaussian kernel filter of size seven is firstly used to reduce image noise and make the image smoother. Then, the Sobel filter with aperture three is used to work out the horizontal and vertical average gradients by using a pair of convolution arrays acting in the two directions as
(12)
We define the gradient magnitude asGand the gradient direction asθ, namely
(13)
Finally, by suppressing the non-maximal value, excluding the false edge points and leaving the pixel points that may be edge points, the final edge points are determined with a hysteresis threshold which is composed by an upper threshold and a lower threshold.
The key to obtain ideal edge detection results is to choose appropriate hysteresis thresholds. After the hysteresis threshold is selected, whether the pixel point is an edge point is determined as below:
1) While the pixel point has a gradient value higher than the upper threshold value, regarded it as an edge pixel point.
2) While the pixel point has a gradient value between the upper and lower thresholds and is connected to the pixel whose gradient value is greater than the upper limit, retain the pixel.
3) While a pixel point has a gradient value below the lower threshold, exclude the point.
If the lower limit of the threshold is too high, the boundary points of the fringe with small gradient values in the bottom half will be incorrectly excluded for they are very likely below the lower threshold, as shown in Fig.15(b). If the upper limit is too low, the non-edge point with high gradient will be misjudged as edge points for they are easily higher than the upper threshold, as shown in Fig.15(c).
Fig.15 Fringe area of original image and edge detection results using different double threshold values
Fig.16 Edge detection results
In Fig.15(d), the edge points of the fringe image after histogram equalization are determined correctly for an appropriate double threshold is selected. And now the fringe image is converted into a binarized image containing only the edges. When there are defects on the surface of the ceramic ball, the shape of the fringe changes and the fringe edge which is supposed to be flat approximately is disturbed by the defect contour, and there will be crossing points on the image. Fig.16(a) and Fig.16(b) are the edge detection results for the non-defective ball and the defective ball when the double thresholds are 20 and 60, respectively.
The positions of defect contour points on the ceramic ball surface can be found by the feature points in the edge binary image, that is, the crossing points described above. In this paper, row difference and template matching are used to determine feature points.
By doing forward pixel-value difference for each column in the binary image of fringe edges, the difference result is left in the place where the subtrahend is used to be to get a new binary picture.
In theory, for a non-defective ball, the edge of the fringe is a set of equally spaced lines parallel to the longitudinal axis in the image coordinate system with fringes reflection used in this paper. After row difference, the fringe edge will disappear in the new binary picture, as shown in Fig.17(a). For a defective ball, the defect area modulates the fringe information, making the fringe distorted, the row difference cannot eliminate all the outlines. That is to say, in theory, after row difference, the edge of the strip will disappear while the defect outline will remain and the feature points will be left , as shown in Fig.17(b).
Fig.17 Row difference results
However, the practical result of row difference is another thing for the fringes that are not entirely flat and straight mainly caused by two reasons: (1) The relative position between the ceramic ball, the industrial camera and the lens is a little different from that in the theoretical model. (2) The lens distortion is another reason. With curved fringes, row difference cannot eliminate the fringe edge on the ceramic ball surface.
To accurately distinguish the “false” feature points formed by the fringe bending and the “true” feature points formed by the defect contour, the algorithm in this paper proposed the template matching step to remove the outliers after row difference. As shown in Fig.18(a) and Fig.18(b), the radius of curvature of the curved fringe is larger than that of the defect contour. The “false” feature points have a low density in the row difference result, while the “true” feature points have a high density.
Fig.18 Row difference results of actual fringes
According to the differences above, several matching templates are designed, as shown in Fig.19. Going through the pixel points in the binary picture after row difference, when the point and its neighbourhood conform to the matching template, it is considered to be the “true” feature point formed by the ceramic ball defect edge contour.
Fig.19 Matching template
As shown in Fig.17(a), the “true” feature points left outline the contour of the pit on the ceramic ball surface. The feature points are concentrated and large in number. After template matching, there are no “fake” feature points as shown in Fig.17(b). Therefore, the non-defective ball and the defective ball can be easily distinguished by the feature points number.
To illustrate the performance and the effectiveness of the algorithm, some experiments are conducted on ceramic balls with different kinds of defects.
Feasibility verifying tests were carried out taking black silicon nitride ceramic balls with a diameter of 6.35 mm as an example. In the industrial field, all the ceramic ball surface defects which are bigger than 20 μm are required to be detected. As there is noise during the experiment, deficiencies can be accurately judged only when they occupy over 4 pixels. To achieve the accuracy requirements, the image pixel equivalent in tests should be less than 5 μm.
Setting the field of view to be 12 mm×10 mm, appropriately larger than the ceramic ball diameter which is 6.35 mm, the minimum resolution calculated with 5 μm pixel equivalent is 2 400×2 000, as calculated by
12×103÷5=2 400,
9×103÷5=2 000.
(14)
An MV-EM1400C high-resolution CMOS camera was selected, whose parameters are listed in Table 1. The camera captured pictures of 4 608×3 288 pixels, as shown in Fig.4, with approximately 1 924 pixels occupied by the ceramic ball diameter. The pixel equivalent calculated is
6.35×103÷1 924≈3.30.
(15)
The result satisfies detection requirements.
Table 1 Specifications of the camera
The calculated imaging system magnification is 0.42. The distance between the measured objects and the lens is about 85 mm, so the lens focal length calculated accordingly is about 25 mm, as calculated by
F=1.4÷33≈0.42,
(16)
(17)
Then the AFT-2514MP optical fixed-focus lens with a focal length of 25 mm was selected, and the lens parameters are in Table 2.
Table 2 Specifications of the lens
The imaging system was built on a precision optical platform, and its optical axis was perpendicular to the platform. The reflective fringe screen was also vertical to the optical platform, 30 mm away from the centre of the ceramic ball. The experimental setup is shown in Fig.20.
Fig.20 Experimental configurations
Fig.21 illustrates the algorithm flow to examine ceramic balls with a diameter of 6.35 mm.
Fig.21 Algorithm flow chart
Depending on the Intel Core i5 processor, VS2010 and OpenCV, the algorithm consumed 0.78 s on average to detect a single picture of 4 608×3 288 pixels.
Tests were done on seven types of ceramic balls: non-defective balls and ceramic balls with pits, smears, cracks, scratches, and scuffs on the surface. The morphological operation was performed on the binary image after template matching to facilitate observation, and results are shown in Fig.22. Table 3 shows the defect detection data results.
Fig.22 Experimental results of different defects
Table 3 Defect detection data results
This paper presents a visual detection algorithm for surface defects of ceramic spheres based on fringe reflection, which has advantagesas belows:
1) The detection speed is fast. Programmed in C language, only 0.78 s was costed for the algorithm to test a picture.
2) The algorithm has high detection accuracy. Its detection limit is at least 16.5 μm, shorter than 20 μm, satisfying detection requirements.
3) The algorithm is robust. While the luminous environment is fixed, defect detection accuracy is high for all types of common defects, like pits, smears, cracks, scratches and scuffs.
4) The algorithm simplifies the inspection process. With the template matching, the algorithm can effectively detect defects without camera calibration and distortion correction. Meanwhile, the algorithm flow is simple. In a fixed luminous environment, different kinds of defects can be detected without changing any. Thus, the algorithm is quite suitable for industrial sites.
Additionally, the detection area can be located automatically based on grayscale value accumulative difference. Combined with a mechanical structure to unfold the ceramic ball surface, the algorithm is expected to be applied to rapid online detection in the future[14].
Journal of Measurement Science and Instrumentation2020年1期