A visual inspection system for detecting end gap and light leakage of the piston ring

: A fully automatic visual inspection system for piston ring was proposed in this study. This system can automatically feed the piston ring, and then detect the end gap and the light leakage of the piston ring. Moreover, the piston ring can be classified after detection and the detection data can be saved for further analysis. To achieve this objective, the detection equipment was established for detecting the end gap and the light leakage, and corresponding software was developed based on Labview. The experiment was carried out and the detection performance of the system was evaluated. The result shows that the proposed system has a good accuracy for detecting the piston ring.


Introduction
The piston ring is an important part of the internal combustion engine, and it was widely used in many parts of the internal combustion engine. Its performance has a decisive impact on the quality of the internal combustion engine [1].
The air tightness of the outer wall of the piston ring and the cylinder directly determines the working efficiency of the internal combustion engine. In China, the light seal between the piston ring and the standard ring gauge indirectly reflects the air tightness. The definition is: the ability to put the piston ring in the ring gauge of the cylinder diameter, and its outer circular surface prevents light from passing through [2]. In production practice, a new concept is derived from the ability of light leakage by observing the light leakage to judge the ability of light to pass through. The closing gap of the piston ring is the closing gap in which the piston ring is placed in the standard cylinder and appears at the closing. The closing gap is to prevent the piston ring from getting stuck in the cylinder after thermal expansion, so the size of the piston loop closing gap is of great significance to the movement of the piston. The measurement system based on machine vision is one of the important means for the manufacturing industry to realize automatic measurement. It has high efficiency, high precision, high automation and good anti-interference ability. It can achieve non-contact measurement and can be widely used in the online detection of various workpieces, including the measurement of finished products and the measurement of product wear. Therefore, how to give full play to the advantages of machine vision in measurement and control, and develop an updated, more scientific and reasonable piston ring quality detection system will be a very meaningful work [3][4]. The Importance of Party History Education and Study

System description
The overall design of the system is divided into four modules, namely, image acquisition module, parameter setting module, piston ring measurement module and data management module. The image acquisition module is the foundation of the whole system, which is composed of cameras, image acquisition cards and light sources. The parameter setting module can set the parameters of the system, such as system calibration, piston ring standard parameter setting, piston ring standard template setting, target area setting, etc. The piston ring measurement module is the key to the whole system. In this module, the automatic tracking, positioning and measurement of the target must be achieved, and the reliability and accuracy of the measurement results must be ensured. After each time the system completes the measurement of the two parameters of the piston ring, the data management module will automatically save the measurement results directly in the database. In the data saving template, the system uses Access for data saving and can query and call data. The overall block diagram design of the system is shown in Figure 1.

System hardware
In order to ensure that the system measurement results are correct and reliable, the system must choose a high-resolution camera. This system adopts Fangcheng IK500M CCD industrial camera. Its parameters are as shown in Table 1 [5]. Since the image collected by the camera is a grayscale picture, the system uses a grayscale picture to process the image. The camera has 5 million pixels, a vertical resolution of 1944px and a horizontal resolution of 2592px.The end gap of the plug loop is filled with the camera field of view (the piston loop end gap is 850um). Calculated at a vertical resolution, the maximum accuracy of the camera's detection of the end gap of the piston loop is: Maximum detection accuracy Accuracy of end gap = Vertical resolution of end gap Accordingly, the maximum accuracy of end gap detection is 0.44um.
Fill the light leakage area of the piston ring with the camera market (the diameter of the piston ring is 50000um). Calculated at vertical resolution, the maximum accuracy of the camera's light leakage detection of the piston ring is: In the IMAQ VISION toolkit, almost all image processing uses subpixel algorithms, and its subpixel accuracy is onehalf, one-third or one-quarter [6].NI Vision uses the interpolation method to locate a boundary. The first thing to find the boundary is to get the edge strength distribution. In essence, it is a function of the pixel value relative to its position. Quadratic interpolation finds its fitting parabola through three adjacent edge strength values. The maximum or minimum point of the curve represents the position and strength value of the edge interpolation point, which is usually not an integer. Cubic spline interpolation is a similar principle, but the interpolation process is based on four adjacent pixels. For example, if you choose a quarter, it means that each pixel is calculated as four pixels horizontally and vertically. Therefore, if a 5x5 pixel image selects a quarter of the subpixel accuracy, it is equivalent to creating a 16x16 discrete dot matrix, which is interpolated. Please refer to Figure 2. The red dot represents the original pixel, and the black dot represents the newly generated subpixel.
Therefore, the highest accuracy of end gap measurement with IMAQ VISION can be increased from the original 0.44um to 0.11um, and the highest accuracy of light leakage detection can also be increased to 6. 4um.In general, the light leakage width of the piston ring is between 10um and 30um, so a 5-megapixel camera can accurately measure the light leakage.
After sampling and quantification, the image is converted into a digital image and is entered and stored. Because the transmission of image signals requires a high transmission speed, the general transmission interface cannot meet the requirements, so an image acquisition card is required. When the signal input rate of the image acquisition card is high, the bandwidth between the image acquisition card and the image processing system needs to be considered. When using PC, the theoretical bandwidth peak of the image acquisition card using the PCI interface is 132MB/S. The system uses a 1394 image acquisition card to connect the PC and the camera. The 1394 image acquisition card follows the IEEE1394 bus standard. The new version of IEEE 1394 can reach up to 1.6 Gbps, much higher than the 480 Mbps of USB 2.0. The 1394 card now has a data transfer rate of 400Mbits/s, which can connect or disconnect in real time without losing or interrupting data, so as to achieve fast data transfer. The piston ring is taken with an IK500M camera, with an image size of 4. 80Mbit.The transmission rate of the system 1394 acquisition card is 400Mbit/s, which means that the system only needs 12ms to transmit a frame of image, which can meet the real-time requirements of the system. The light source is a very important part of the machine vision system. Whether the light source is suitable or not will directly affect the quality of the image, and then affect the performance of the system. Generally, as a machine vision light source, there are fluorescent light sources, filament light sources, LED light sources and optical fiber light sources. LED light source is selected in this system.

Image binarization
This system uses a backlit light source, and the grayscale difference between the piston ring profile and the background is obvious. Therefore, the area segmentation method is used to binarize the image. IMAQ Threshold.vi is used to design a binary program to realize the binary processing of images. IMAQ Threshold.vi is shown in Figure 3. Set the feature threshold to 125 to process the image.

Target tracking
This system is based on IMAQ VISION and uses template matching to calibrate the target position. Through IMAQ VISION's own IMAQ Find CoordSys (Pattern) 2.vi, you can quickly establish a coordinate system, as shown in Figure 4. vi Find the template in the rectangular search area of the input image, and use the coordinates and direction of the template to determine the coordinate system or follow the new coordinate system. By default, IMAC Find CoordSys (Pattern) 2.vi does not allow the template to rotate more than 4°However, there is no rotation limit for the matching process as needed. Enter the template and target image, and set relevant parameters, and IMAC Find CoordSys (Pattern) 2.vi can automatically establish or update the coordinate system. IMAQ Find CoordSys (Pattern) 2.vi In the rectangular search area of the input image, find the template, and use the coordinates and direction of the template to determine the coordinate system or follow the new coordinate system. By default, IMAQ Find CoordSys (Pattern) 2.vi does not allow the template to rotate more than 4°, but there is no rotation limit for the matching process as needed. By entering the template and target image, and setting relevant parameters, IMAQ Find CoordSys (Pattern) 2.vi can automatically create a coordinate system or update the coordinate system.

Piston loop end gap detection
The clearance width of the piston ring is an important parameter of the piston ring. Under normal circumstances, its width ranges from about 100mm to 1000mm.For end gap measurement, first locate the target through template matching, then detect the edge within the target range, then locate the edge, and finally calculate the pixels of the shortest straight line between the two edges. The system uses IMAC Clamp Horizontal Max.vi to design the measurement algorithm. The sub-vi of the algorithm is shown in Figure 5.

Piston ring light leakage detection
For light leakage detection, the process is similar to the end gap width detection. The system adopts a region segmentation algorithm to binarize the original image, and uses template matching to establish a new coordinate system to track and locate the target area. Through edge detection, the boundary is extracted, and the light leakage is located. The system uses IMAQ Find Circular Edge.vi to design the piston ring light leak detection algorithm. IMAQ Find Circular Edge.vi is shown in Figure 6.IMAQ Find Circular Edge.vi performs edge detection, discovery and positioning of edges in the set area.

Piston loop closure clearance measurement
Compare the measurement results with the standard parameters and classify the piston ring. The system also has a statistical function, which can count the number of piston rings at all levels that have been measured. The system uses a red coordinate system to mark the target position, and you can intuitively see the positioning of the target by the system. The rendering is shown in Figure 7.

Piston ring light leakage measurement
After the measurement of the width of the end gap, the next step is to carry out light leakage detection. Figure 8 is the light leakage detection panel of the piston ring of the system. There is only one measurement result of the panel, that is, whether there is light leakage. If the leakage of the piston ring is measured, the light leakage LED of the panel will turn red, 161 indicating the measurement result. The measurement results are automatically saved to the database. Figure 9 shows the system production query panel. After the system completes a measurement, the results will be automatically saved in the database. Through this panel, it can be used to query the annual, monthly and daily production.

Indicators achieved by the system
The object measured by this system is the closed clearance width of the piston ring. According to the measurement requirements, the measurement process not only needs to be measured in real time, but also the measurement speed and accuracy must meet the relevant technical indicators. According to the hardware conditions of the system and the results measured by the system, the system can achieve the following indicators: 1). Detection speed After testing, it is obtained that the speed of the whole measurement process of the system is about 30 pieces/min. It only takes 100ms/piece to measure the parameters of the piston ring. It takes about 3 seconds to detect one tablet by skilled manual measurement.
2). Detection accuracy The accuracy of detection and measurement of piston rings with IMAQ VISION can reach 1.7um, while the light leak detection accuracy of piston ring can reach 5um, that is to say, the minimum width of light leakage width that can be detected by the system is 5um.

Conclusion
This paper applies virtual instrument technology to the field of image processing based on image processing. The piston ring quality detection method based on IMAQ combines digital image processing technology with machine vision, makes full use of the IMAQ VISION software package to study the piston ring detection algorithm. It gives full play to the advantages of short development cycle, simple programming and high code reuse rate of virtual instruments. A virtual instrument visual detection system is designed and applied to the field of piston ring quality detection. The system realizes the functions of positioning and accurate measurement of images, and verifies the effectiveness and accuracy of the algorithm through experimental results.