On site calibration of inner defect detection based on structured light

A special calibration cylinder is intended to meet the actual requirement of calibration in defect detection system, and a calibration method is proposed based on this calibration the cylinder. The relative measurement method is adopted in the measurement of inner diameter of cylinder. Through processing the structured light image of inner surface of calibrated cylinder, the relationship between the depth of groove in calibrated cylinder and the distance between the displaced pixels of structured light stripes is obtained, which is used in the calculation of groove depth, and the wear of inner diameter of cylinder is obtained. Experiments show that this method can effectively adapt to the detection environment with a small field of view and weak light, and have higher calibration accuracy, and can meet the actual needs of the detection system calibration.


Introduction
Cylinder is a key executive component of gun to realize its power.When fired, the projectile is given initial velocity, rotational speed and flight direction under the action of powder gas [1].In the course of launching, the inner chamber must bear the harsh environment of high temperature, high pressure and severe friction, which will inevitably lead to defects affecting the artillery technical performance.Therefore, it is particularly important to inspect the inner chamber of artillery regularly and discover the hidden danger in the inner chamber of artillery in time.At present, the detection methods of gun bore defects are mainly caliper method and peep chamber method.Although these methods can detect and judge the inner bore defect to a certain extent, they have some shortcomings, such as low detection efficiency, high probability of misjudgment, easy to cause secondary damage and so on.
Structured light detection technology is a machine vision detection method.It uses image and structured light source measurement technology to analyze the unknown physical information through the geometric information of the known illumination light source [2][3][4].Compared with the traditional detection technology, it gets the advantages of non-contact, high precision and high efficiency.In structured light detection technology, the combination of laser and camera is called visual sensor.It is the main of structured light detection technology.The sensor model and model parameters will directly determine the accuracy of the detection system.Therefore, the rapid and accurate calibration of visual sensors is the basis for accurate detection of structured light.
For the calibration of the vision sensor, it can be divided into camera parameter calibration and system structure parameter calibration [5,6].At present, the most widely used camera parameter calibration method is based on coplanar reference object calibration method proposed by Zhang Zhengyou [7].For the calibration of the sensor's structural parameters, there are methods such as wire drawing calibration and tooth profile calibration [8].Because the working environment of the bore defect detection system has the characteristics of a small field of view and weak light, the traditional calibration method has great limitations [9,10].
In this paper, a calibration method suitable for bore defect detection system is proposed, and a special three-dimensional target is designed.Using of feature points on the target, the camera parameters can be calibrated quickly.On this basis, the system structure parameters can be calibrated effectively by combining the distance constraints and angle constraints of the target feature points.

Detection system composition and working principle
The light path principle of the gun interior defect detection system based on structured light is shown in Fig. 1.

Fig. 1. Optical path schematic diagram of detection device
There are two mirrors inside the measuring device.The angle between the left reflector and the horizontal direction is 45°, and the angle between the right reflector and the horizontal direction is 22.5°.The laser grating is incident horizontally on the right reflector, and then at an angle of 45° to the detected object.The reflected light is then illuminated vertically on the left reflector and is incident horizontally on the camera for imaging.In this design, the laser grating and the camera are mounted on the same axis, which ensures the minimum radial dimension of the detector and facilitates the detection of the detector in the narrow space of the artillery.
The main components of structured light detection system include laser, object under test, camera and computer.The laser emits a parallel beam of structured light, which carries the characteristic information of the inner chamber with the bright area formed by the interception of the inner chamber of the gun.The main task of the camera is to get the image which contains the feature information of the bore.It is transmitted with the computer by cable, so that the image taken can be transmitted to the computer for further processing.

Calibration principle
The calibration of the structured light detection system takes the form of determining the parameters of each part of the system, and it is also the basis for the system to complete the predetermined function and achieve the predetermined accuracy [11][12][13].According to the different calibration objects, the detection system is separated into camera calibration and structural light parameter calibration.

Design and manufacture of calibration cylinder
Rifling is a spiral groove which is processed on the surface of the cylinder and has a certain inclination angle with the axis of the cylinder.Grooves with different sizes and different arrangement patterns are processed in the calibration cylinder.The purpose is to show the various characteristics of grooves in the image of extraction according to different needs.Fig. 2 is a calibrated cylinder made of four sets of grooves in the calibration cylinder.The first two sections are all stepped grooves with 4 and 5 steps respectively, and the height of each step groove is 1mm.The latter two sections are groove arrays with the same dimension and equal spacing along the axis direction, with the width of 3 mm and the depth of 1 mm and 2 mm, respectively.

Camera calibration
The calibration of camera parameters can be summarized as the process of calculating camera parameters from the world coordinates of feature points and the image coordinates of the obtained calibration images.The basic idea is to extract the pixel coordinates of the feature points from the image obtained by the camera through the method of feature extraction, and to solve the camera parameters with the camera model.Because the parameters needed to be calibrated are more, the two step method is utilized to complete the calibration.
The first step is to calculate the image coordinates after the distortion by the distortion model: Among them,  = 1, 2, 3,...,  and  is the calibration feature point.
Then use radial constraints to establish equations, as shown in Eq. ( 2): Finally, we compute the  ,  and  by using the orthogonality of the R matrix.
The second step is to first solve the  and  by using the following formula, as shown in Eq. ( 3): Then Levenberg-Marquardt algorithm is used to optimize the parameters.When the parameters are optimized, only the minimum of Eq. ( 4) is required, and the values of ,  ,  and  are the optimal values: (,  ,  ,  ) = ( −  ) + ( −  ) . (4)

Calibration of structured light parameters
The point of intersection between the light plane and the calibration block is selected as the control point, which is expressed by C1-CN.Since the coordinates of the feature points in the image is known, the coordinates of the control points can be obtained according to the invariance of the cross ratio: where  ,  represents the distance between two points on the image,  ,  represents the distance between two points in the space.
On the basis of solving the coordinates of control points, the equation of light plane can be obtained by using any three non-collinear control points.At the same time, the least squares method can be used to fit the equation of light plane for more than 3 points.

Calibration experiment
In order to verify the effectiveness of the calibration method, the calibration experiment of the gun inner chamber defect detection system was carried out.The experimental equipment, as shown in Fig. 3, mainly includes the prototype of the detection system and the calibration board.The CM-140 CCD camera from JAI company is selected as the imaging element, the resolution of the camera is 1392×1040, and the laser grating with 250 mW power is selected as the light source.

Fig. 3. Calibration system for testing system
In the calibration experiment, the calibration board is placed in different positions within the field of view of the camera.To ensure the reliability of the experiment, 15 positions are used to calibrate the camera parameters and the structure parameters of the detection system.

Calibration of camera internal parameters
When calibrating the internal parameters of the camera, the first 14 positions are used to calibrate the internal parameters of the camera.Finally, the calibration results are substituted into the coordinates of the fifteenth position and compared with the actual coordinates.The accuracy of calibration is evaluated by the RMS error evaluation method and the method proposed in document [14].The results are shown in Table 1.
As can be seen from Table 1, the calibration error is slightly larger than the reference value.The main reason is that the calibration plate used in this paper is smaller, more sensitive to various factors of calibration environment, and more external interference.And the calibration board in the production process due to the limitations of processing technology, there are errors to a certain extent.The calibration results will also have a greater impact.

Calibration of structural parameters of detection system
After the camera internal parameters are calibrated, the parameters of the system structure are calibrated using the obtained results.Combined with the calibration values of camera parameters, the accurate model of the system can be obtained.Table 2 is a comparison between the coordinate values of the characteristic points calculated by the calibrated model and the actual coordinate values, which can be used as a judgment index of the measurement accuracy of the system.
It can be seen from Table 2 that the calibration method presented in this paper have higher calibration accuracy.In the process of calibration experiment, random error will inevitably be introduced, and the quality of structured light source, the error of calibration image feature extraction and other aspects will have a certain impact on the calibration results page.

Conclusions
Aiming at the actual requirement of calibration in bore defect detection system, a special calibration cylinder is designed and a calibration method is proposed.The calibration cylinder can effectively determine the camera parameters, structure parameters and fit the light plane equation of the detection system, and the proposed method can calibrate the detection system with high accuracy.Next, we plan to analyze the three-dimensional shape of the object based on the calibrated detection system.

Fig. 4 ( 4 .
Fig. 4(a) A structured light image is captured in the smooth area of the calibration cylinder.It can be seen that there are many noise points in the image.Fig. 4(b) Structured light images taken from the calibrated cylinder stepped groove region show a significant truncation and offset of the structured light fringes, which are modulated by a sudden change in the depth of the cylinder surface at the stepped groove due to the oblique projection of structured light from the structured light projector onto the inner surface of the cylinder.The three non striped black area in the image is the area where the structural light cannot be projected due to the depth of the groove.

Table 1 .
Calibration results and errors of camera internal parameters

Table 2 .
Measurement accuracy analysis of defect detection system Characteristic points