# A New Method for Detecting Compensation Hole Parameters of Automobile Brake Master Cylinder Based on Machine Vision

Authors: Changfu Zhao; Hongchang Ding; Guohua Cao; Ying Zhang
Journal: Journal of Advanced Transportation
 (2021)

---

## Abstract

The machining accuracy of the compensation hole of the automobile brake master cylinder directly determines the safety of the automobile and the reliability of parking. How to detect the parameters of the compensation hole with high precision becomes a crucial issue. In this paper, by analyzing the principle of Hough transform detection technology and several optimization algorithms, a new method combining Zernike moment and improved gradient Hough transform is proposed to detect the circular hole parameters. The simulation experiment shows that the proposed algorithm satisfies 0.1 pixels in the coordinate detection of the center position, and the radius detection accuracy is 0.05 pixels, with fast detection speed and good robustness. Compared with the random Hough transform algorithm and the gradient Hough transform algorithm, the algorithm proposed in this paper has higher detection accuracy, faster detection speed, and better robustness, which meets the online detection accuracy requirements of the brake master cylinder compensation hole.


---

## Body

## 1. Introduction

With the development of society, automobiles are also increasing. The reliability of automobile braking systems has become an important issue to be considered in the development of the automobile industry. At present, the compensation hole hydraulic brake master cylinder [1–3] is still an important part of the automobile brake system. The purpose of the brake master cylinder is to transfer the pressure of the driver on the brake pedal through a vacuum booster to the brakes of the four wheels so that the vehicle can decelerate or stop. As a key part of adjusting the brake fluid in the reservoir and pressure chamber of the automobile’s brake master cylinder, its dimensional accuracy and processing quality are strictly controlled. Taking the brake master cylinder of ZDZG-22.2-12.385-1 as an example, the nominal size of the compensation hole diameter is 0.7 mm, and the dimensional accuracy is ±0.021 mm. The service life requirement of brake master cylinder of automobile in China is to achieve 500,000 times at normal temperature and 120,000 times at 70°C. However, if the size of compensation hole does not meet the precision requirement, it cannot play the role of accurately controlling the speed of the brake fluid adjustment and the brake will fail, so the number of uses is far less than the use requirements; thus, the size of the compensation hole of the master cylinder must strictly meet the accuracy requirements. However, because the compensation hole of the automobile brake master cylinder is located on the inner side wall of the deep cavity blind hole [4], the existing measuring methods mainly include contact measurement and noncontact measurement, the contact-type measuring is mainly mechanical, such as coordinate measurement. Some scholars have proposed other contact measurement methods. For example, Professor Masuzawa of Tokyo University of Japan proposed a method for measuring deep-hole inner diameter by oscillating scanning measurement. The measurement method is to apply an oscillating circuit to the probe. When the probe contacts the hole wall, the circuit is online and disconnected when it is not in contact. The length of signal that can be detected is determined by the distance between the probe and the hole wall. The aperture is determined by the duty cycle of the signal. Although the contact measurement guarantees the accuracy of dimension to a certain extent, it is difficult to guarantee the real-time detection, and it will produce certain wear on the workpiece. The sampling and individual measurement methods of contact measurement lay a great hidden danger to the reliability of the automobile brake system. With the development of noncontact measurement, noncontact measurement has attracted more and more attention of scientific researchers due to its advantages such as no force on workpiece, fast detection speed, and high detection accuracy. Relevant scholars have developed a large-scale spy bore system based on CCD-TV [5], which can save and recall the observed images and qualitatively observe the aperture through optical means. However, the equipment is large and bulky, which is not easy to operate. Subsequently, in Zhang [6] et al.’s study, by using the structure of periscope and cooperating with grating ruler and stepper motor, the aperture measurement was realized. Wang [7] et al. developed a device for measuring position parameters of compensation hole by means of human–machine interaction. However, due to manual participation, the diameter of compensation hole detected is affected by workers’ actual working experience and fatigue level, and its detection accuracy is low. Du et al. [8], based on LabVIEW software, using image processing algorithms such as filtering, segmentation, and fitting, designed a set of high-precision visual inspection systems with high detection accuracy and fast processing speed, which provides important help for modern hole-type parts inspection method.With the continuous development of machine vision, with its advantages of high efficiency, accuracy, and stability, it has become a very good method for noncontact measurement [9–12]. Through image processing algorithm, the parameter detection of target in image is completed, in which Hough transform detects target in image through space conversion and achieves better results. The circle Hough transform (CHT) is a parameter estimation algorithm based on the voting principle proposed by Hough in 1962 [13–15]. Circle Hough transform maps the sample points to the parameter space by using the transform of two coordinate systems and then determines the circular parameters by finding the peak value in the parameter space by using statistical voting or building an accumulator. Circle Hough transform has good robustness and antinoise ability. However, because the traditional Hough transform is a one-to-many mapping, there are problems such as a large amount of calculation, a large amount of resources, and a long detection time. In 1993, Xu et al. [16–18] proposed the Randomized Hough Transform algorithm (RHT), based on the principle that three points that are not on a straight line can determine the center of the circle, realizes many-to-one mapping, avoids a huge amount of calculation, and reduces the demand for memory. Afterwards, the researchers integrated the gradient information into the Hough transform, that is, the gradient Hough transform [19, 20], using the principle that the edge point gradient points to the center of the circle, to convert the cumulative matrix of the circle contour from three-dimensional to two-dimensional, but the algorithm is affected by noise serious. Therefore, in 2005, Cai and Zhou [21] proposed the gradient symmetry Hough transform, which effectively avoided the influence of noise on the coordinates of the detection circle center position by finding the gradient symmetry point. There are also some scholars who combine the Hough transform algorithm with machine learning algorithms to achieve very good results in target positioning, size detection, and flaw detection. Cha et al. [22] by combining the Hough transform with the support vector machine algorithm have constructed a robust separator, which automatically detects the bolt tightening and loosening and has real-time performance. Liu et al. [23] completed the detection of fabric point defects by combining the Hough transform and the application of the confrontation network. The defect detection rate is as high as 97.2%, which is better than traditional defect detection algorithms.However, because these algorithms are based on pixel-level original contour extraction, they cannot meet high-precision detection requirements. For example, the accuracy of the edge detection of the brake master cylinder compensation hole directly affects the detection accuracy of the compensation hole size. If the detection accuracy is only improved from the hardware aspect, it will be very expensive. Therefore, how to implement subpixel edge detection through algorithms has become a research hotspot. Subpixel edge detection is to decompose the target edge pixels to locate more accurate edge positions. As the related algorithms of image edge subpixel detection [24–26] are successively proposed and improved and optimized, it is possible to detect the size of high precision. Therefore, the algorithm in this paper is combined and improved on the existing algorithm, and a high-precision method for obtaining circle parameters is proposed. The Zernike moment and the improved gradient Hough transform algorithm are combined to detect the circle hole parameters and realize the compensation of the automobile brake master cylinder. The high-precision detection of hole parameters is compared with similar algorithms under the same conditions. It is better than other algorithms in terms of speed, accuracy, robustness, etc. Therefore, the algorithm proposed in this paper can realize the real-time online detection requirements of the compensation hole of the automobile brake master cylinder.


## 2. Subpixel Image Edge Extraction Based on Zernike Moment

Currently, subpixel edge detection algorithms mainly include moment method [25], interpolation method [27, 28], and edge fitting method [29, 30].Subpixel edge detection algorithm based on moment method mainly consists of gray moment, space moment, and Zernike moment. Zernike moment is an orthogonal moment [31] proposed by Ghosal and Methrotal in 1993, which solves the problem of redundant information in image processing because polynomials do not possess orthogonality. In this paper, the improved Zernike moment is used to extract the subpixels of the edge of the compensation hole. Figure 1 is the model of the subpixel edge of the image. The circle is the unit circle. The line L represents the ideal edge of the part surrounded by the unit circle. The gray values on both sides of the inner edge of the unit circle L are h and h+k, where k is the gray difference, l represents the distance from the origin to the edge, and ϕ represents the angle between the l- and x-axes. Figure 2 is the image of Figure 1 rotated by ϕ. At this time, the edge in the unit circle is perpendicular to the x-axis. Let the rotated image be f′x,y, so the following relationship exists:(1)∬x2+y2≤1f′x,yydxdy=0Figure 1
Subpixel edge image model.Figure 2
Subpixel edge image model after rotation.The first step is to calculate the template coefficients of different orders. Using Zernike template [32], the template coefficients M00, M11, and M20 of different orders of Zernike moment are calculated, as shown in Tables 1–4.Table 1
M00 mask.
00.02870.06860.08070.06860.028700.02870.08150.08160.08160.08160.08150.02870.06860.08160.08160.08160.08160.08160.06860.08070.08160.08160.08160.08160.08160.08070.06860.08160.08160.08160.08160.08160.06860.02870.08150.08160.08160.08160.08150.028700.02870.06860.08070.06860.02870Table 2
M11 real mask.
0−0.015−0.01900.0190.0150−0.0224−0.0466−0.023300.02330.04660.0224−0.0573−0.0466−0.023300.02330.04660.0573−0.069−0.0466−0.023300.02330.04660.069−0.0573−0.0466−0.023300.02330.04660.0573−0.0224−0.0466−0.023300.02330.04660.02240−0.015−0.01900.0190.0150Table 3
M11 imaginary mask.
0−0.022−0.0573−0.069−0.0573−0.02240−0.015−0.046−0.0466−0.046−0.0466−0.0466−0.015−0.019−0.023−0.0233−0.023−0.0233−0.0233−0.01900000000.0190.02330.02330.02330.02330.02330.0190.0150.04660.04660.04660.04660.04660.01500.02240.05730.0690.05730.02240Table 4
M20 mask.
00.02250.03940.03960.03940.022500.02250.0271−0.012−0.026−0.0120.02710.02250.0394−0.012−0.052−0.066−0.052−0.0120.03940.0396−0.026−0.066−0.079−0.066−0.0260.03960.0394−0.012−0.052−0.066−0.052−0.0120.03940.02250.0271−0.012−0.026−0.0120.02710.022500.02250.03940.03960.03940.02250Through the convolution of the template and the image, Zernike’s momentsZ00, Z11, and Z20 of different orders are obtained. Since the Zernike moment Zmn′ after the image rotation angle ϕ remains the same as the Zernike moment Zmnbefore image rotation, only the phase angle changes; the following relationship exists:(2)Zmn′=Zmne−inϕ.If the rotated Zernike moment is represented byZ00, Z11, and Z20, according to the rotation invariance of formula (1), Z00′, Z11′, and Z20′ can be expressed by the following equation:(3)Z00′=Z00,Z11′=Z11e−iϕ,Z20′=Z20,where Z11′=Z11e−iϕ can be expressed in the following form:(4)Z11′=cosϕReZ11+sinϕImZ11+sinϕReZ11−cosϕImZ11i.It can be seen from formula (1) that the imaginary part of Z11′ is 0; then the following relational expression is given:(5)ImZ11′=sinϕReZ11−cosϕImZ11=0,where ReZ11 and ImZ11 represent the real and imaginary parts of Z11, respectively. Then, you can get the ϕ calculation formula as follows:(6)ϕ=tan−1ImZ11ReZ11.Put the real and imaginary parts of the calculation resultZ11 and the rotation angle ϕinto formula (1), to obtain the Z11′ moment of the image after the image is rotated, as shown below:(7)Z11′=cosϕReZ11+sinϕImZ11.According to the model in Figure1, the calculation expressions of different orders of Zernike moment can be calculated after rotation.The relationship ofZ00′is as follows:(8)Z00′=2∫−1l∫01−x2hdydx+2∫l1∫01−x2h+kdydx.Simplify and get the expression ofZ00′as follows:(9)Z00′=hπ+kπ2−ksin−1l−kl1−l2.The relationship ofZ11′is as follows:(10)Z11′=2∫−1l∫01−x2hx−iydydx+2∫l1∫01−x2h+kx−iydydx.The expression ofZ11′ obtained by simplification is as follows:(11)Z11′=2k1−l23/23.The relationship ofZ20′is as follows:(12)Z20′=2∫−1l∫01−x2h2x2+2y2−1dydx+2∫l1∫01−x2h+k2x2+2y2−1dydx.Simplify the expression ofZ20′ as follows:(13)Z20′=2kl1−l23/23.Solving equations (3), (9), (11), and (13), we can further derive the distance from the origin to the edge l, the gray value h, and the gray value difference kon both sides of the edge, the specific expressions.Calculate the distancel from the origin to the boundary:(14)l=Z20Z11′.Calculate the gray difference valuekon both sides of the boundary and the gray value hon one side of the boundary:(15)k=3Z11′21−l23/2,h=Z00−kπ/2+ksin−1l+kl1−l2π.After determining the inclination angleϕof the edge, the distance lfrom the origin to the straight line, the gray value h, and the gray difference value k, the subpixel edge determination condition k≥kt∩l≤ltof Zernike moment is passed, and the point satisfying the condition is the subpixel edge point corresponding to the edge of the circular hole, where ktand lt are the threshold of gray difference and the threshold of distance from center to edge, respectively. The threshold value is determined by preexperiment. The larger kt and the smaller lt indicate that the harsher the conditions and the more accurate the subpixel edge was obtained, the same fewer edge points can be obtained.Finally, while considering the template magnification effect [33], the subpixel coordinate position xs,ysof the image is calculated by the following formula. The template effect is that the subpixel edge error is caused by the different size of the selected template, as long as it is calculated on the unit circle. The distance is increased to N/2times the original, and the influence of the template effect can be removed. The specific expression is as follows, where Nis the template size:(16)xsys=xy+NL2cosϕsinϕ.


## 3. Hough Transform Based on Gradient Information

The Hough transform based on gradient information refers to the principle that the gradient direction of all pixels on the edge of the target points to the center of the circle. Due to the introduction of the gradient direction information of the edge, the parameter space is transformed from three-dimensional to two-dimensional, and the coordinate and gradient direction of pixel points on each target edge are made straight lines, and each point on the line is voted, in which the highest voting position is the coordinates of the center of a circle as shown in Figure3.Figure 3
Gradient Hough transform.The two edge points in Figure3 are PAand PB. The coordinates of the two points are XPA,YPAand XPB,YPB, respectively. The gradient directions of the two points are dy/dx|PAand dy/dx|PB. After the edge points, draw straight lines LAand LB along the gradient direction. The intersection of the two straight lines is the target contour. The position of the center of the circle is represented by O, and the center coordinates of the target contour can be calculated as OXe,Ye[34]:(17)Xe=dy/dx|PA⋅XPA−dy/dxPB⋅XPB−YPA−YPBdy/dx|PA−dy/dx|PB,Ye=dy/dx|PA⋅XPA−dy/dxPB⋅XPB−dy/dx|PA⋅dy/dx|PBYPA−YPBdy/dx|PA−dy/dx|PB.And by calculating the average value of the distanceDi from the center coordinate OXe,Ye to each pixel point Pii=1,2,…,non the edge of the target contour, the radius R of the target circle can be obtained. The specific expression is as follows:(18)Di=Pix−Xe2+Piy−Ye2,i=1,2,…,n.In the formula,Pix and Piyare the coordinates of the pixel Pi on the edge contour, and Di is the distance between Pi and the center of the circle O.By calculating the average value of Di by the following formula, the radius of the target circle R can be obtained:(19)R=1n∑i=1nDi,i=1,2,…,n.However, the actual image will inevitably be affected by noise during acquisition and transmission, and the line in the gradient direction of edge points does not pass through the center accurately, so large errors will occur in calculating the position of the center of circle, which will affect the detection of the center and radius of the target contour.


## 4. Circular Parameter Detection Algorithm Based on Circular Gradient Center Symmetric Point Hough Transform

Due to the Hough transform based on gradient information, in the presence of noise, the normal direction will be offset from the center of the circle. while there are still a large number of invalid accumulation problems in the symmetric Hough transform based on circular gradient. The algorithm in this paper is based on gradient information. It is proposed on the basis of Hough transform and circular gradient symmetry Hough transform. By calculating the detection method of Hough transformation of the center symmetry point of the circular gradient, the algorithm replaces the need to find symmetry points about theX-axis and theY-axis in the circular gradient symmetry method and then accumulates the data on the median bisector of the symmetry point, which causes a lot of invalid accumulation problems. It is proposed to find symmetrical points directly. Because the symmetrical points on the circle pass through the center of the circle, a large amount of invalid accumulation time can be saved to realize the parameter detection of the circular hole.The principle of the Hough transform algorithm based on the center symmetry point of the circular gradient is to randomly select a point on the edge of the target and then search for the symmetry point in the image. The meaning of symmetric point is that the direction of vertical gradient and horizontal gradient are opposite to the direction of selected point. The relationship between the direction and size of the symmetry point is shown in Figure4.Figure 4
Relation diagram of gradient directions of symmetrical points on a circle.In the figure,Vrepresents the vertical direction, and Hrepresents the horizontal direction, where the direction of the arrow represents the gradient direction, and its combined direction points to the center of the circle. We can see from the graph that points a and d are symmetrical with respect to origin O, they have similar size on gradient value, opposite vertical direction, and opposite horizontal direction, and the center of the circle passes through the line between points a and d. By finding a point in the rectangle surrounded by point a at the upper-left corner and d by point d at the lower-right corner, the angle between point a and point d is smaller than a fixed threshold θt, and the value of θtis determined by a preexperiment. The larger the value is, the more demanding the conditions are, and the fewer points fall in the region. Instead, the more points fall in the region and the more points the center may be voted on. By randomly selecting points on the target edge several times for calculation, the possible center position of the circle is formed at the center of the circle as shown in Figure 5. The center of the circle is calculated as the center of the target circle.Figure 5
The location of the center of the voting center.The algorithm does not completely rely on the gradient direction to determine the position of the center of the circle while using the gradient. The noise points in the image are removed by searching for the symmetrical points of the center of the circle. In the case of defective edges of the circle image, the parameter information of the circle can also be accurately detected.


## 5. Experiment and Result Analysis

According to the Hough transform based on the central symmetry point of the circular gradient and the joint-improved Zernike moment detection algorithm proposed in this paper, the subpixel edge detection is performed for the compensation hole of the automobile brake master cylinder and the parameters of the circular hole are obtained. The image of the hole is only a part of the image. If the entire image is detected, the detection speed will inevitably be reduced. With the development of deep learning, Fast-RCNN based on convolutional neural network that automatically locates and detects the appearance area shows excellent characteristics [35, 36], so through network migration, the input layer and output layer of the trained Fast-RCNN network are removed, and the middle layer is retained. By collecting 40 images of compensating holes of different brake main cylinders as training images, the trained network can accurately and quickly detect the area of compensation hole from the image, realize fast positioning of compensating holes, and then only perform edge detection on the area of compensating holes to achieve high-precision detection of compensating hole size. The specific detection steps are as follows:Step 1. Firstly, the trained Fast-RCNN is obtained through network migration, which can quickly locate the compensation hole in the area and then only process the compensation hole in the area.Step 2. The area of compensation hole detected in Step1 is filtered by Gauss filtering to filter the noise in the image in preparation for the next edge detection.Step 3. For the noise-reduced image obtained by Step2, the Zernike moment is calculated to obtain the subpixel coordinates of the image edge. Since the internal environment of the automobile brake master cylinder is similar, the subpixel positioning on both sides of the edge can be determined through preliminary experiments. Therefore, the values of gray difference threshold kt and distance threshold lt on both sides of edge in subpixel positioning can be determined experimentally in advance; in this article, the values ofkt and lt are predetermined to be 43 pixels and 0.1143 pixels by experiment.Step 4. The edge detection of the compensation hole is performed through the Sobel operator, the gradient value and direction angle of the edge are calculated, and the gradient image is obtained.Step 5. Randomly select a point from the position of the edge in the gradient image and find the edge point that is symmetrical to the center of the target edge, that is, the pixel point with similar gradient size and opposite horizontal gradient and vertical gradient.Step 6. Find the center point of the circle that meets the conditions from the area enclosed by the two edge points. The condition is that the angle difference between the center point of the circle and the two edge points is less than the set threshold θt, and the center point that meets the condition is voted. Among them, θt is determined by preexperiment, and the value of θt is 3° in this algorithm.Step 7. As shown in Figure 6, calculate the average value of the distance between the center of the circle O and the subpixel point on the edge of the circle through formulas (18) and (19), and record it as the radius R.Step 8. Draw it in the image.Figure 6
The voting results of the location of the center of the circle.


### 5.1. Detect Ideal Image Experiment

First, a 500∗500 image is generated by using the computer, in which a circle with a center of O (220, 280) pixels and a radius of R of 95.5 pixels is generated, in which the background is black, and the circle is white. By comparing the traditional random Hough transform, the Hough transform based on gradient value and the calculation accuracy and frame rate of the algorithm in this paper, as shown in Figures 7(a)–7(d), the red origin in the graph represents the center of the circle detected, and the green circle represents the edge of the circle detected by the algorithm. Through subjective observation of the circular edge detection effect in the figure, the random Hough and gradient Hough transform have little difference in the center position detection, but they exist on the edge of the circle. The detection algorithm proposed in this paper is obviously superior to the other two detection algorithms in the center of the circular hole and the edge detection effect.Figure 7
Round edge detection results. (a) Computer-generated image. (b) Random Hough transform algorithm. (c) Gradient symmetry algorithm. (d) This algorithm detects images.
(a)(b)(c)(d)The edge parameters of computer-generated circular image are detected, including the size of the image being 500∗500 pixels, the theoretical center position of the circle O being (220, 280) pixels, and the theoretical radius R being 95.5 pixels. The center position deviation detected by random Hough transform and gradient Hough transformation is between 1 and 2 pixels, and there is no deviation in the center position through the algorithm proposed in this paper. In terms of circular radius detection, the deviation between the radius and the theoretical radius pixel detected by random Hough transform and gradient Hough transform is more than 2 pixels, and through the detection algorithm proposed in this paper, the difference between the detected radius pixel value and the theoretical pixel value is only less than 0.05 pixels, and the detection accuracy is higher. In terms of the complexity of the algorithm, we know that the traditional Hough transform is a typical “one-to-many” mapping. The algorithm time complexity is On3. The random Hough transform and gradient Hough transform developed on the basis of it being in complexity aspects have been reduced, but the time complexity of the algorithm is still On2, and the algorithm proposed in this paper is simple and the parallel processing method has been adopted to further improve the complexity of the algorithm. The complexity of the algorithm is Onlogn. From the table below, it can also be seen from the processing frame rate that when processing an image with a resolution of 500∗500 pixels, the frame rate processed by this algorithm is 3, while the frame rate of the other two algorithms is 2, so the processing frame rate of this algorithm is better than the other two algorithms being more suitable for the needs of online detection. The circular parameters detected are shown in Table 5.Table 5
The detection results of the circular parameters of the generated image.
ParameterTheoretical valueRandom Hough transformGradient Hough transformThis paper algorithmCenter (x, y)(220, 280)(222.0, 281.5)(221.0, 281.2)(220.00, 280.00)Relative error(0, 0)(2, 1.5)(11.2)(0, 0)RadiusR95.593.36392.25195.496Relative error0−2.137−3.249−0.004FPS3223


### 5.2. Algorithm Robustness Experiment

Because image is susceptibly contaminated by noise in the process of forming, transmitting, receiving, etc., and image noise will affect the result of image edge detection and then affect the detection accuracy of target size, this article is verified by manually adding noise to the generated image. The robustness of the proposed algorithm is verified. Among them, Gaussian noise is the most widely existing noise in image noise. Therefore, by adding Gaussian noise to the generated image, the robustness performance of the algorithm in this paper is verified. In the computer-generated image, the mean valueμ=0 and the variance are, respectively, added. The Gaussian noises of σ=0.01, σ=0.05, and σ=0.1 can be seen from Figures 8(a) and 8(d). With the increase of variance, the noise content in image increases gradually, but the center and edge contour of the circle detected by the algorithm in this paper do not change significantly. Even when the image is heavily contaminated by noise, it still has a good noise resistance, which shows that the proposed algorithm has good robustness.Figure 8
Circular detection effect of noise pollution. (a) Computer-generated image. (b)σ=0.01 algorithm image. (c) σ=0.05 algorithm image. (d) σ=0.1 algorithm image.
(a)(b)(c)(d)


### 5.3. Actual Detection Experiment of Compensation Hole

Finally, a motion mechanism and image acquisition system with high accuracy and efficiency are developed and tested on this system [2, 37].This experimental system consists of a high-precision lifting mechanism, an integrating sphere lighting system, a CCD camera, a self-developed double telecentric endoscope system, a motor, and a software processing system. As shown in Figure 9, by rotating the screw, the lifting mechanism with CCD camera enters the interior of the main brake cylinder of the vehicle, illuminates the integral ball illumination device outside the main brake cylinder, collects a clear image of the compensation hole of the secondary cylinder through software, transmits it to the computer in real time, and carries out real-time processing to obtain the contour information of the compensation hole of the standard master cylinder.Figure 9
Photoelectric detection system for the compensation hole of the automobile brake master cylinder.The algorithm flow is shown in Figure10.This experiment detects the master cylinder of model ZDZG-22.2-12.385-1, the compensation hole diameter is 0.7 mm, and the detection accuracy is ±0.021 mm.Figure 10
Flowchart of the automobile brake master cylinder detection.In order to compare the detection effects of various detection algorithms on the compensation hole being fair, we analyze the two aspects of (1) subjective observation of the compensation hole detection effect and (2) objective data detected by the compensation hole. First, collect a picture of the compensation hole of the automobile brake master cylinder. The picture of the compensation hole is shown in Figure11(a). The same compensation hole image is rounded by the random Hough transform mentioned above, the gradient-based Hough transform, and the algorithm in this paper. The edge detection algorithm is implemented. The experimental computer for various algorithms is configured with i7cpu2, 8G memory, Windows 10 operating system, and the software used is MATLAB 2015b. The detection results are shown in Figures 11(b)–11(d).(1)
Through subjective observation, we can see that the edge position of the compensation hole detected by random Hough has a large offset from the actual compensation hole, and the detected circle contour is obviously larger than the contour of the compensation hole, and the error is relatively large. The gradient information-based Hough transform is obviously better than the random Hough transform in the detection effect, and its relative error in the detection of the center position of the compensation hole is small, but there are still some errors in the contour detection of the compensating hole. The joint Zernike moment and the Hough transformation algorithm of the center symmetry point of the circular gradient proposed in this paper have better effect in detecting the parameters of the circular hole. It can be seen from Figure11(d) that the edge overlaps well with the center position and edge of compensating hole, and there is no obvious offset in the center of compensating hole, which indicates that the detection effect of compensating hole is very accurate.(2)
By recording the objective data of the compensation hole parameters and displaying it in Table6, it is known from the above that the ZDZG-22.2-12.385-1 model master cylinder has a compensation hole radius of 0.35 mm, which is defined by one pixel in the image calibration. The representative actual size is 0.007291 mm, so the standard pixel size of the compensation hole in the image is 48 pixels. From Table 6, it can be seen that the pixel value of the compensation hole radius detected by the algorithm in this paper has the smallest difference with the standard size pixel value. It is 0.105 pixels, and the frame rate detected by the algorithm in this paper is also higher than the frame rate of the other two calculations. Therefore, it can be said that the detection accuracy and detection speed of the algorithm in this paper are due to the other two detection algorithms, using standard gauge blocks. After camera calibration [38, 39], the actual size of pix corresponding to each pixel is 0.007291 mm, and the actual diameter D of the brake master cylinder compensation hole is calculated by the formula(20)D=2∗pix∗n=2∗0.007291∗48.105=0.70151.Figure 11
Edge image of detection result. (a) Picture of compensation hole. (b) Random Hough transform. (c) Gradient Hough transform. (d) This paper algorithm.
(a)(b)(c)(d)Table 6
Statistics table of size detection results of compensation hole of automobile brake master cylinder.
ParameterRandom Hough transformGradient Hough transformThis paper algorithmCenter of circle (x, y)(108.6, 105.8)(107.1, 107.7)(106.6, 107.92)RadiusR49.62551.43448.105FPS223Finally, using random Hough transform, gradient Hough transform, and the algorithm in this paper, the same master cylinder compensation hole size is detected 30 times, and the pixel size of each time is recorded to form the experimental data shown in Table7. The algorithm proposed in this paper calculates the average pixel radius of the compensation hole is 48.002 pixels, and the standard deviation is 0.003, which is better than random Hough transform and gradient Hough transform. The detection accuracy of the average radius is higher than 1.5 pixels. And draw the error between it and the standard size as the error curve shown in Figure 12. It can be clearly seen from the graph that the random Hough transform and gradient Hough transform algorithms have large errors, while the algorithm proposed in this paper has small errors and compensates. The accuracy of the hole radius is controlled within 0.05 pixels, which is significantly better than the other two detection algorithms. Therefore, the algorithm proposed in this paper has fast detection speed, high repeatability, and meets the real-time requirements of industrial sites.Table 7
Statistical table of 30 compensation hole radius size inspection.
Number of timesRandom Hough transformR/pixelGradient Hough transformR/pixelPaper algorithmR/pixelNumber of timesRandom Hough transformR/pixelGradient Hough transformR/pixelPaper algorithmR/pixel148.75748.51248.0211648.92348.80648.035248.72348.73648.0351746.84547.72847.984348.53647.56847.9551848.85249.21647.996447.52449.54548.0321949.66847.23648.003548.46748.63648.0432048.32447.72448.002647.32648.63447.9812147.74548.44847.959749.83547.33248.0422248.44846.76747.968847.53648.86947.9812347.78848.42647.984948.66549.23448.0002447.59548.37348.0331048.86946.84248.0212548.49549.35348.0151149.96548.76548.0142646.52747.22147.9861248.84548.42347.9532748.68448.54548.0441346.53447.23247.9822849.75546.65847.9921447.87648.15448.0432946.63546.83547.9511547.76948.32147.9673046.44548.81548.034Mean48.16548.19948.002Variance0.9860.8240.030Figure 12
The error curve of the compensation hole radius of the 30 times brake master cylinder.


## 5.1. Detect Ideal Image Experiment

First, a 500∗500 image is generated by using the computer, in which a circle with a center of O (220, 280) pixels and a radius of R of 95.5 pixels is generated, in which the background is black, and the circle is white. By comparing the traditional random Hough transform, the Hough transform based on gradient value and the calculation accuracy and frame rate of the algorithm in this paper, as shown in Figures 7(a)–7(d), the red origin in the graph represents the center of the circle detected, and the green circle represents the edge of the circle detected by the algorithm. Through subjective observation of the circular edge detection effect in the figure, the random Hough and gradient Hough transform have little difference in the center position detection, but they exist on the edge of the circle. The detection algorithm proposed in this paper is obviously superior to the other two detection algorithms in the center of the circular hole and the edge detection effect.Figure 7
Round edge detection results. (a) Computer-generated image. (b) Random Hough transform algorithm. (c) Gradient symmetry algorithm. (d) This algorithm detects images.
(a)(b)(c)(d)The edge parameters of computer-generated circular image are detected, including the size of the image being 500∗500 pixels, the theoretical center position of the circle O being (220, 280) pixels, and the theoretical radius R being 95.5 pixels. The center position deviation detected by random Hough transform and gradient Hough transformation is between 1 and 2 pixels, and there is no deviation in the center position through the algorithm proposed in this paper. In terms of circular radius detection, the deviation between the radius and the theoretical radius pixel detected by random Hough transform and gradient Hough transform is more than 2 pixels, and through the detection algorithm proposed in this paper, the difference between the detected radius pixel value and the theoretical pixel value is only less than 0.05 pixels, and the detection accuracy is higher. In terms of the complexity of the algorithm, we know that the traditional Hough transform is a typical “one-to-many” mapping. The algorithm time complexity is On3. The random Hough transform and gradient Hough transform developed on the basis of it being in complexity aspects have been reduced, but the time complexity of the algorithm is still On2, and the algorithm proposed in this paper is simple and the parallel processing method has been adopted to further improve the complexity of the algorithm. The complexity of the algorithm is Onlogn. From the table below, it can also be seen from the processing frame rate that when processing an image with a resolution of 500∗500 pixels, the frame rate processed by this algorithm is 3, while the frame rate of the other two algorithms is 2, so the processing frame rate of this algorithm is better than the other two algorithms being more suitable for the needs of online detection. The circular parameters detected are shown in Table 5.Table 5
The detection results of the circular parameters of the generated image.
ParameterTheoretical valueRandom Hough transformGradient Hough transformThis paper algorithmCenter (x, y)(220, 280)(222.0, 281.5)(221.0, 281.2)(220.00, 280.00)Relative error(0, 0)(2, 1.5)(11.2)(0, 0)RadiusR95.593.36392.25195.496Relative error0−2.137−3.249−0.004FPS3223


## 5.2. Algorithm Robustness Experiment

Because image is susceptibly contaminated by noise in the process of forming, transmitting, receiving, etc., and image noise will affect the result of image edge detection and then affect the detection accuracy of target size, this article is verified by manually adding noise to the generated image. The robustness of the proposed algorithm is verified. Among them, Gaussian noise is the most widely existing noise in image noise. Therefore, by adding Gaussian noise to the generated image, the robustness performance of the algorithm in this paper is verified. In the computer-generated image, the mean valueμ=0 and the variance are, respectively, added. The Gaussian noises of σ=0.01, σ=0.05, and σ=0.1 can be seen from Figures 8(a) and 8(d). With the increase of variance, the noise content in image increases gradually, but the center and edge contour of the circle detected by the algorithm in this paper do not change significantly. Even when the image is heavily contaminated by noise, it still has a good noise resistance, which shows that the proposed algorithm has good robustness.Figure 8
Circular detection effect of noise pollution. (a) Computer-generated image. (b)σ=0.01 algorithm image. (c) σ=0.05 algorithm image. (d) σ=0.1 algorithm image.
(a)(b)(c)(d)


## 5.3. Actual Detection Experiment of Compensation Hole

Finally, a motion mechanism and image acquisition system with high accuracy and efficiency are developed and tested on this system [2, 37].This experimental system consists of a high-precision lifting mechanism, an integrating sphere lighting system, a CCD camera, a self-developed double telecentric endoscope system, a motor, and a software processing system. As shown in Figure 9, by rotating the screw, the lifting mechanism with CCD camera enters the interior of the main brake cylinder of the vehicle, illuminates the integral ball illumination device outside the main brake cylinder, collects a clear image of the compensation hole of the secondary cylinder through software, transmits it to the computer in real time, and carries out real-time processing to obtain the contour information of the compensation hole of the standard master cylinder.Figure 9
Photoelectric detection system for the compensation hole of the automobile brake master cylinder.The algorithm flow is shown in Figure10.This experiment detects the master cylinder of model ZDZG-22.2-12.385-1, the compensation hole diameter is 0.7 mm, and the detection accuracy is ±0.021 mm.Figure 10
Flowchart of the automobile brake master cylinder detection.In order to compare the detection effects of various detection algorithms on the compensation hole being fair, we analyze the two aspects of (1) subjective observation of the compensation hole detection effect and (2) objective data detected by the compensation hole. First, collect a picture of the compensation hole of the automobile brake master cylinder. The picture of the compensation hole is shown in Figure11(a). The same compensation hole image is rounded by the random Hough transform mentioned above, the gradient-based Hough transform, and the algorithm in this paper. The edge detection algorithm is implemented. The experimental computer for various algorithms is configured with i7cpu2, 8G memory, Windows 10 operating system, and the software used is MATLAB 2015b. The detection results are shown in Figures 11(b)–11(d).(1)
Through subjective observation, we can see that the edge position of the compensation hole detected by random Hough has a large offset from the actual compensation hole, and the detected circle contour is obviously larger than the contour of the compensation hole, and the error is relatively large. The gradient information-based Hough transform is obviously better than the random Hough transform in the detection effect, and its relative error in the detection of the center position of the compensation hole is small, but there are still some errors in the contour detection of the compensating hole. The joint Zernike moment and the Hough transformation algorithm of the center symmetry point of the circular gradient proposed in this paper have better effect in detecting the parameters of the circular hole. It can be seen from Figure11(d) that the edge overlaps well with the center position and edge of compensating hole, and there is no obvious offset in the center of compensating hole, which indicates that the detection effect of compensating hole is very accurate.(2)
By recording the objective data of the compensation hole parameters and displaying it in Table6, it is known from the above that the ZDZG-22.2-12.385-1 model master cylinder has a compensation hole radius of 0.35 mm, which is defined by one pixel in the image calibration. The representative actual size is 0.007291 mm, so the standard pixel size of the compensation hole in the image is 48 pixels. From Table 6, it can be seen that the pixel value of the compensation hole radius detected by the algorithm in this paper has the smallest difference with the standard size pixel value. It is 0.105 pixels, and the frame rate detected by the algorithm in this paper is also higher than the frame rate of the other two calculations. Therefore, it can be said that the detection accuracy and detection speed of the algorithm in this paper are due to the other two detection algorithms, using standard gauge blocks. After camera calibration [38, 39], the actual size of pix corresponding to each pixel is 0.007291 mm, and the actual diameter D of the brake master cylinder compensation hole is calculated by the formula(20)D=2∗pix∗n=2∗0.007291∗48.105=0.70151.Figure 11
Edge image of detection result. (a) Picture of compensation hole. (b) Random Hough transform. (c) Gradient Hough transform. (d) This paper algorithm.
(a)(b)(c)(d)Table 6
Statistics table of size detection results of compensation hole of automobile brake master cylinder.
ParameterRandom Hough transformGradient Hough transformThis paper algorithmCenter of circle (x, y)(108.6, 105.8)(107.1, 107.7)(106.6, 107.92)RadiusR49.62551.43448.105FPS223Finally, using random Hough transform, gradient Hough transform, and the algorithm in this paper, the same master cylinder compensation hole size is detected 30 times, and the pixel size of each time is recorded to form the experimental data shown in Table7. The algorithm proposed in this paper calculates the average pixel radius of the compensation hole is 48.002 pixels, and the standard deviation is 0.003, which is better than random Hough transform and gradient Hough transform. The detection accuracy of the average radius is higher than 1.5 pixels. And draw the error between it and the standard size as the error curve shown in Figure 12. It can be clearly seen from the graph that the random Hough transform and gradient Hough transform algorithms have large errors, while the algorithm proposed in this paper has small errors and compensates. The accuracy of the hole radius is controlled within 0.05 pixels, which is significantly better than the other two detection algorithms. Therefore, the algorithm proposed in this paper has fast detection speed, high repeatability, and meets the real-time requirements of industrial sites.Table 7
Statistical table of 30 compensation hole radius size inspection.
Number of timesRandom Hough transformR/pixelGradient Hough transformR/pixelPaper algorithmR/pixelNumber of timesRandom Hough transformR/pixelGradient Hough transformR/pixelPaper algorithmR/pixel148.75748.51248.0211648.92348.80648.035248.72348.73648.0351746.84547.72847.984348.53647.56847.9551848.85249.21647.996447.52449.54548.0321949.66847.23648.003548.46748.63648.0432048.32447.72448.002647.32648.63447.9812147.74548.44847.959749.83547.33248.0422248.44846.76747.968847.53648.86947.9812347.78848.42647.984948.66549.23448.0002447.59548.37348.0331048.86946.84248.0212548.49549.35348.0151149.96548.76548.0142646.52747.22147.9861248.84548.42347.9532748.68448.54548.0441346.53447.23247.9822849.75546.65847.9921447.87648.15448.0432946.63546.83547.9511547.76948.32147.9673046.44548.81548.034Mean48.16548.19948.002Variance0.9860.8240.030Figure 12
The error curve of the compensation hole radius of the 30 times brake master cylinder.


## 6. Conclusion

By introducing the algorithm theory of Hough transform and Zernike moment, this paper improves the edge detection algorithm of Hough transform based on gradient direction symmetry and achieves subpixel edge detection by combining Zernike moment. By comparing various Hough transform algorithms and the algorithm in this paper, it is found that the algorithm in this paper can accurately detect the parameter information of compensation hole of brake master cylinder, the radius detection accuracy is controlled at 0.05 pixels, with high detection accuracy, high speed, high repeatability, and good robustness; the new detection method is provided for online detection of compensation hole parameter information of automobile brake master cylinder. Although the proposed algorithm has some advantages in edge detection of compensation hole, how to further improve the speed and accuracy of detection becomes a difficult problem. With the development of deep convolution neural network, it gradually shows better effect in target recognition and semantics segmentation. How to combine classical image processing algorithm with depth learning algorithm? It will be the trend of our future research to apply it to the detection of compensation hole in the automobile brake master cylinder.



---

*Source: 8864679-2021-04-08.xml*