The roundness error is the main geometric characteristic parameter of shaft and hole parts. Evaluation accuracy is an important indicator of the quality inspection technology. Existing roundness error evaluation methods are insufficient in terms of the calculation amount, convergence speed, and calculation accuracy. This study proposes a novel roundness error evaluation method based on improved bee colony algorithm to evaluate the roundness error of shaft and hole parts. Population initialization and search mechanism were considered for the optimal design to improve the convergence precision of the algorithm. The population was initialized in the local search domain defined by the contour data. The roughness error was obtained by the convergence solution of the circle center calculated iteratively by the step-decreasing method. The roundness error was also evaluated by taking the same set of image domain data as an example to verify the feasibility of the proposed method. The algorithm exhibited higher accuracy than that traditional methods and thus can be widely used to evaluate the roundness error of shaft and hole parts.

Automatic online detection and real-time evaluation of the geometric errors of parts are important components of the intelligent upgrading of manufacturing systems; they also provide theoretical bases for material scheduling design and the self-optimization of process parameters of intelligent manufacturing systems (Tang et al., 2018). Roundness error is one of the main geometric characteristic parameters of shaft and hole parts. Evaluation accuracy is an important indicator of quality inspection technology. Compared with manual contact measurement, machine vision detection has the advantages of non-contact and high precision. Therefore, it has been increasing used in industrial manufacturing (Zhu et al., 2020).

Least square circle (LSC), minimum circumscribed circle (MCC), maximum inscribed circle (MIC), and minimum zone circle (MZC) are the main roundness error evaluation algorithms (Ding et al., 2013). Error problem solution, shaft roundness error evaluation, and hole roundness error evaluation are commonly calculated by LSC, MCC, and MIC, respectively. Only MZC conforms to the direct definition of roundness error. MZC belongs to the unconstrained nonlinear optimization calculation, which is a cumbersome solution process. The particle swarm optimization algorithm (PSO; Cui et al., 2006), region search method (Rossi et al., 2016; Huang et al., 2008), geometric optimization method (Zhang et al., 2010; Li et al., 2010), geometric relation method (Li et al., 2009; Song et al., 2022), and geometric constraint search method (GCSM; Yue et al., 2020; Rajamohan et al., 2021; Singh et al., 2021) have been proposed to simplify the computational complexity. PSO requires a large number of parameters to be entered manually. The region search method and geometric optimization method have the disadvantage of a large amount of computation and slow convergence speed; as such, they have poor applicability for the calculation of large data. MCC and MIC are required by geometric relation, but the process of obtaining the largest inscribed circle is complicated and has no uniform standard yet. A charge-coupled device (CCD) camera measurement is contactless, its detection speed is faster than the coordinate measuring machine (CMM) method, and it is easier to automate the measurement, making the detection results more accurate.

At present, the CMM method is mostly used for feature point detection, i.e., a small number of feature point parameters on the contour of the part are obtained, and the roundness error of the part is obtained accordingly. The use of CCD camera measurement can obtain a large number of part profile data points, and the roundness error evaluation results are more accurate. However, it also leads to a large volume of raw data and complex calculations when using the MZC principle, so this paper uses an improved artificial swarm algorithm to optimize the solution process and improve the solution speed. To solve the shortcomings of the above methods, scholars consider the bee colony algorithm, which emphasizes the behavior pattern of bee colony foraging. It takes into account few input parameters and has higher strength in optimizing solutions than genetic algorithm, PSO, and ant colony algorithm (Li et al., 2012). Local search ability needs to be further improved due to the influence of random numbers in the algorithm (Jadon et al., 2015). Hence, an improved artificial bee colony (IABC) algorithm was developed for the roundness error evaluation in an image domain. Taking the shaft part as an example, the part outline roundness data were processed through the vision system. The position and size of the error evaluation circle were calculated by the proposed algorithm. The local search domain for population initialization was judged according to the definition of roundness error to improve the efficiency of the algorithm. The roughness error was obtained by the convergence solution of the circle center calculated iteratively by the step-decreasing method. Analysis was performed by comparing the computational results of various existing methods using the same original data. The results showed that the evaluation accuracy of the proposed algorithm was better than that of commonly used algorithms.

High-precision measurement systems for roundness error parameters mainly include three-coordinate measuring machines, acoustic emission side heads, capacitive probes, photodiodes, laser sensors, and CCD cameras (Zhang et al., 2014). The machine vision system with a CCD camera has the advantages of easy installation and high measurement accuracy. Therefore, the system was adapted to obtain the original image data of shaft parts.

The roundness error was evaluated by using the end-face image; the quality of the obtained image will directly affect the detection precision of the whole measurement. Pictures were acquired by backlighting and using a CCD digital camera with a fixed-focus lens to improve image quality. The schematic diagram of image acquisition is shown in Fig. 1.

Schematic diagram of the roundness error measurement device.

After obtaining the axial projection of the measuring part, part profile roundness data were obtained by graying and edge detection through machine vision technology. Figure 2 shows the procedure of the contour boundary extraction. Figure 2a shows the original picture from the camera. The part profile roundness data are presented in Fig. 2b.

Contour boundary extraction.

The set of contour boundary data points from the graph domain is denoted as

Schematic diagram of the roundness error.

The traditional artificial bee colony (TABC) algorithm, an intelligent algorithm, completes the optimization process of the objective function through the cooperation of the population. The population is divided into the following three categories: leading bees, following bees, and scouting bees (Karaboga et al., 2014). First, the population is initialized, and parameter optimization is then carried out through the cycle iteration of leading bees, following bees, and scouting bees. The current optimal solution is regarded as the final result until the algorithm reaches the predetermined cycle number or meets the error condition. The algorithm implementation steps are as follows.

Generally, the initialized population is randomly processed to generate a new nectar source. The initial population is randomly described by Eq. (2).

The leading bees randomly select one data value of generated nectar source. A new mining source is created based on Eq. (3). The fitness value of the new mining source, which represents the objective value, is evaluated by a fitness function in Eq. (4).

The significance of following bees is that mined the fitness value

If a nectar source is followed for a certain number of times, then the fitness value of the objective function

The abovementioned TABC randomly generates the initial solution within the solution interval. The randomness, the global exploration ability, can be guaranteed. However, the rationality of the distribution of the initial population in the solution space is not perfect. Equation (2) shows that the new obtained solution depends on the quality of the random number. The result will probably cause a gathered phenomenon and an uneven distribution of the initialized population, thereby affecting the stability of the algorithm and iterative efficiency.

The improved bee colony algorithm (IABC) is proposed to improve the convergence accuracy of the algorithm for the solution of circle center coordinates. First, the local search domain is determined according to the original contour data. The convergent solution of the center of the circle is iteratively calculated by the step-decreasing method.

The population initialization region is determined according to the coordinates of the original contour data points to reasonably limit the search domain. It is equal to the solving range of the circle center. The specific steps are as follows.

The dimension of initialize population is

When solving the circumscribed circle and the inscribed circle, the initial
circle center is obtained by Eq. (6) for the outer contour of the
aforementioned part. More precise coordinates of the circle center are
obtained by Eqs. (7) and (8).

The more uniform the initial solution distribution is, the more likely it is
to search in the neighborhood of the optimal solution (Liu et al., 2017).
The feasible region is divided evenly to ensure the uniformity of the
initial population. A rectangular feasible region of the solution is
constructed with the initial coordinates of the center of the circle

Initialization of the local regional population average.

The step-decreasing search method and the neighborhood search mechanism were adopted in the above uniform discrete interval. The purpose is to attract the following bees to iterate and update near the nectar source with a high adaptive value, guide the direction of random number, and improve the convergence speed of the algorithm.

In order to improve the solving efficiency of the algorithm and use the
existing solution results, the step-decreasing search method was adopted.
The nectar source update times

When the fitness value has not been updated continuously for

Algorithm flow chart.

A detection device was established according to the detection principle.
Figure 6a and b show the detection device and pre-measured part, respectively. The camera model is a Basler ace acA4600-7gc, with a resolving power of

Visual roundness error detection.

The calibration method (Zhang, 2000) was used to calibrate and correct the
internal and external parameters of the camera using a checkerboard. The
alignment of the shaft against the light source is a major concern in such
vision-based systems. In order to solve this problem, this paper adopts the
following methods: first, we adjust the camera angle according to the
external parameters of the camera to make the optical axis of the camera
perpendicular to the plane of the backlight. Then, by adjusting the
parallelism between the stage and the light source plane to ensure the
alignment of the axis and the light source, the part is placed in the center
of the camera field of view to extract the edge coordinates. The roundness
error of the

Image preprocessing and edge detection is as follows:

Contour image processing.

The two-dimensional profile data were obtained by visual detection device, which was recorded as the point

Pixel coordinates.

The accuracy of IABC was determined with the conditions of 50 as the total swarm size, 100 iterative numbers, and 15 as the maximum number of iterations of the same nectar source. The roundness error was calculated by the averaged value of running 50 times. Comparing the calculation of LSC and TABC, the results are recorded in Table 2.

Measured dimensions.

As shown in Table 2, compared with the general LSC algorithm, the roundness error evaluation based on the IABC algorithm is smaller, which is in line with the smaller actual roundness error of the needle gauge. The comparison is shown in Fig. 8.

Comparison of the error evaluation results with the least square method.

A comparative analysis was conducted on the same set of measurement data in literature (Cui et al., 2006; Li et al., 2009) to further verify the effect of the proposed algorithm. The coordinates of data points are shown in Table 3.

Coordinates of data points in the existing literature.

The relevant parameter settings of the algorithm in this paper are the same as those in Sect. 3.2. The evaluation results were compared with LSC (Li et al., 2009), PSO (Cui et al., 2006), GCSM (Yue et al., 2020), and MZC (Li et al., 2009), as shown in Table 4.

Comparison of data processing results.

Convergence graph of iteration curve.

The results of the algorithm in this paper were close to the circle center position of LSC, the MZC method in the literature (Li et al., 2009), and PSO in the literature (Cui et al., 2006). Compared with the roundness error evaluation value of LSC (0.0091672738 mm), the evaluation value obtained by MZC in the reference (Li et al., 2009; 0.0086 mm), and the evaluation value of PSO in the reference (Cui et al., 2006; 0.0085 mm), the roundness error evaluation value (0.0085374645 mm) obtained in this paper is more accurate. Moreover, the center position and roundness error calculated in this paper have higher accuracy. It can be seen from the convergence diagram of the iteration curve in Fig. 9 that the initial solution obtained by the IABC is better than the TABC, with a faster convergence speed and a higher precision in the final solution.

IABC was proposed to solve the problem of the roundness error evaluation of
shaft hole parts and the current insufficient accuracy of the roundness error
evaluation. Population initialization, a search mechanism, and the optimal
individual guidance were optimized. An experimental platform of the visual
roundness error detection was established. A series of experiments were
conducted to verify the superiority of the proposed method. Through
evaluating standard needle gauges, the conclusion was drawn that the
method was better than LSC. Additionally, comparative analysis were carried
out based on LSC, PSO and MZC. The calculation results further showed that IABC had more feasibility and accuracy. Those conclusions demonstrate that
the proposed method has certain theoretical and engineering value. In this paper, the roundness error of the part is calculated on the pixel surface. For the actual roundness error (

Code and data can be made available upon request.

BJ provided the idea and wrote the revised draft of the paper. XD wrote the first draft of the paper. LW devised a scheme for the experiment. SB finished the analysis of the experimental data.

The contact author has declared that neither they nor their co-authors have any competing interests.

Publisher's note: Copernicus Publications remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

The authors would like to thank the National Natural Science Foundation of China for supporting this research.

This research has been supported by the National Natural Science Foundation of China (grant no. 52005003).

This paper was edited by Xichun Luo and reviewed by Abhilash Puthanveettil Madathil and one anonymous referee.