The method of checking the side of plastic bottle cap with rota lung line

Update:30 Apr 2020

The method of checking the side of plastic bottle cap with rota lung line
The detection algorithm is different according to different experimental environment conditions. If the height of bottle is stable relative to the camera, then in each captured image of plastic bottle cap. The basic position of the bottle body is stable. The projection contour of the normal top of the bottle cap in the image is straight. As long as the contour of the top of the bottle cap is not straight, it can be inferred that the bottle cap is abnormal. Therefore, in this part of the algorithm, the top contour of the side cap will be directly detected. The state of the cap is judged by the equation of the contour.
Because the position above the cap is blank in the image, the rough position of the cap is found by searching from top to bottom, and the discrete points are found horizontally on the edge. The least square fitting method assumes the combination of n points, which is obtained in the determined function class
In the sense o f set, the point is determined, and the function obtained is the curve y = f (z) O function f (x) with the smallest sum of the square of the distance from the given point, which is called the least square solution. Find the fitting function (the advised method is called the least square method of curve fitting. In this method, the least square fitting of straight line is obtained. Corresponding function expression
For the given linear equation, the bottle cap is processed by the following steps to obtain the straight line where the bottle cap is located. The processing flow is shown in Figure 3. For the known input image is gray image, the image is preprocessed by binarization. Binarization is helpful to reduce the amount of data and improve the processing speed of image. Because the bottle cap area in the pavilion image is continuous black, the V-domain with the bottle cap as the main body can be obtained through corrosion expansion, and then the bottle cap can be analyzed. The mean value coordinates of the regions under the abscissa and the ordinate are obtained respectively. The centroid of the bottle cap is obtained. The largest black region in the image is obtained. That is, the region where the bottle cap is located. Finally, according to the center of mass and the farthest two apex angles above the region, and according to the positions of the two apex angles, the straight line of the bottle cap is obtained. The parameter of the linear equation of the bottle cap is K 2. . 0224, B II 109.9939. Where k is the slope and B is the intercept.
The parameters used in the estimation can be obtained by statistical methods. Through the repeated statistical test of the standard bottle, the estimated parameters K and B can be obtained, and the interval estimation can be carried out according to the statistical error.
In the process of image acquisition, PET bottle cap can estimate the parameters under the condition of small vibration. However, if the bottle tilts violently, the straight line of the top of the normal bottle cap will incline greatly, which will make the normal bottle The cover is determined to be inclined cover, and the false inspection occurs, as shown in Figure 4.
Based on the consideration of the above situation, this paper proposes an improved line fitting method to detect the side of bottle cap.