Using Zhang’s calibration method, the camera was calibrated to obtain the parameters necessary for rectifying the captured images. This process ensured the precise acquisition of pixel coordinates for the chessboard pattern captured by both the left and right cameras. A binocular stereo vision model was then employed to determine the world coordinates of the chessboard pattern. The obtained world coordinates were used as input, while the theoretical world coordinates were used as output. For data computation, a comparative analysis was conducted using different optimization algorithms, including genetic algorithm, particle swarm optimization algorithm, honey badger optimization algorithm, and an enhanced hybrid optimization algorithm that combines differential evolution and particle swarm optimization algorithm.
5.2. Results and Analysis
A binocular camera is used to take multiple photos, which are shown in
Figure 10:
In the camera calibration experiments, the calibration board underwent movement within the field of view of the camera, assuming different positions and angles. This allowed for the capture of multiple sets of detection images for the purpose of calibration. Due to the continuous movement of the calibration board, image blurring may occur during image acquisition, which in turn can affect the accuracy of subsequent corner detection. Therefore, high-quality, non-blurred images were selected from the collected calibration data for the calibration experiments. The process of binocular calibration and corner detection is illustrated in
Figure 11.
The method for camera calibration detailed earlier was applied to derive parameter matrices
and
for the left and right cameras. Correspondingly, matrices
and
representing the distortion parameters for the cameras were acquired. A summary of the findings can be found in
Table 1, with all data rounded to five decimal places.
During this experiment, 15 sets of calibration board images were utilized. The intrinsic and extrinsic parameters of the camera, along with the distortion parameters obtained from the calibration process, were employed to project the corners of the calibration board onto the imaging plane. The calibration error was subsequently evaluated by comparing the pixel coordinates of these points with their actual coordinates on the calibration board. The tabulated results of the calibration errors are documented in
Table 2.
As shown in
Table 2, the overall average calibration error falls within a range of 0.25 pixels.
Figure 12 illustrates the projection of the calibration board’s corner coordinates onto the camera coordinate plane using the camera’s intrinsic and extrinsic parameters derived from reverse projection. Discrepancies between these projected coordinates and the actual corner coordinates in the original image were computed in both the x and y directions. The deviations, quantified in pixels, are denoted by red “o” for the calibration disparities of the left camera and blue “+” for those of the right camera.
After the calibration of both the left and right cameras, the stereo vision calibration can be conducted. The calibration outcomes for the binocular vision system are displayed in
Table 3.
The rotation matrix and translation matrix for stereo calibration, presented in
Table 3, indicate that the rotation matrix bears a striking resemblance to the identity matrix. This similarity can be attributed to the meticulous efforts employed during the setup of the left and right cameras to achieve and maintain their equilibrium.
Following the procedure outlined in the preceding section, the MATLAB implementation of the optimization algorithm program utilized 10 sets of calibration images and experimented with maximum iteration numbers of 200, 400, 600, 800, and 1000. In order to evaluate the calibration performance of the algorithm proposed in this chapter, assessments were carried out employing the genetic algorithm, particle swarm algorithm, honey badger algorithm, and improved differential particle swarm algorithm. The evaluation criteria involved nine parameters,
, and their performance was compared, as presented in
Table 4.
Based on the findings displayed in
Table 4, the camera parameter calibration performed in this investigation meticulously accounted for both radial and tangential distortions. As a result, the influence of distortion and lens aberrations on the measurement outcomes during the camera calibration process was significantly mitigated. To conduct a more comprehensive analysis of the optimization test results, the positional deviations were assessed using the error range and root-mean-square error (RMSE) as indicators of accuracy. The calculation formulas for these two evaluation criteria are provided below:
The root-mean-square errors for position in each direction calibrated by the four optimization algorithms are presented in
Table 5.
Result 1: The fitness curve for the optimization using genetic algorithm is shown in
Figure 13, with a maximum iteration number of 455. The fitness value decreases in a stepwise manner as the iteration number increases and finally reaches zero after 455 iterations. The solution stabilizes thereafter and remains consistent.
Based on
Figure 13 and
Figure 14, it can be observed that the optimization of calibration parameters using genetic algorithm resulted in significant improvement in the corresponding coordinate errors. The error in the
x-coordinate was reduced from approximately 0.3 to within 0.05 after optimization, while the error in the
y-coordinate improved from around −0.5 to within ±0.07. The error in the
z-coordinate was within 0.1 before parameter optimization.
Result 2: The fitness curve for the optimization using particle swarm algorithm is depicted in
Figure 15. The algorithm terminated after 225 iterations, and the fitness value exhibited a stepwise decrease with the increase in iteration count. After 225 iterations, the solution approached zero and stabilized.
The error in the coordinates of the corresponding points before and after optimization can be obtained from
Figure 16. Prior to optimizing the calibration parameters, the error in the
x-direction of the corresponding points was approximately within 0.27, the
y-direction error was within −0.65, and the
z-direction error was within −0.12. After optimization using the particle swarm algorithm, the
x-direction error was within 0.05, the
y-direction error fluctuated within ±0.07, and the
z-direction error was within 0.07. It can be noted that the particle swarm optimization method demonstrated a relatively better improvement in the
y-direction error.
Result 3: The fitness curve after optimizing using the honey badger algorithm is depicted in
Figure 17. The algorithm terminated after 122 iterations, and the fitness value progressively decreased in a stepped manner with increasing iteration count. After 122 iterations, the solution approached zero and reached stability. Based on the convergence of the curve, it is evident that this algorithm exhibits noticeably faster convergence speed and requires fewer iterations compared to the previous two optimization algorithms.
Figure 18 shows the coordinate error curve before and after optimizing the camera calibration parameters using the honey badger algorithm. Based on the error curve, it can be concluded that the honey badger optimization algorithm reduced the error in the
x-direction from 0.56 before optimization to within 0.05 after optimization. Furthermore, the algorithm decreased the error in the
y-direction from −0.66 to within 0.07 and in the
z-direction from −0.14 to within ±0.06. These results indicate that the algorithm greatly improves the error.
Result 4: The fitness curve after optimizing using the improved differential evolution particle swarm algorithm is shown in the
Figure 19 and
Figure 20. It can be observed that the curve depicted fluctuations throughout the first 150 iterations before stabilizing around iteration 400, at which point the calibration optimization results attain stability.
As shown in the above figure, the error curve of the experimental data point coordinates before and after optimizing the camera calibration parameters using the mixed optimization algorithm based on improved differential evolution and particle swarm can be observed. It is apparent that prior to using the mixed optimization algorithm, the error in the x-direction was approximately 0.7, which was reduced to within 0.005 after optimization. Additionally, the error in the y-direction decreased from −0.66 to around −0.07, and the error in the z-direction decreased from −0.17 to near 0. These experimental results indicate that although the convergence speed and iteration count of this algorithm are not the fastest compared to several other optimization algorithms, the optimized parameter results are favorable. Therefore, the mixed optimization algorithm based on improved differential evolution and particle swarm demonstrates the best optimization effect with the lowest error.
Result 5: The fitness curve following DE optimization, as shown in
Figure 21, concluded at iteration 335, demonstrating a stepwise decrease in fitness as the number of iterations increased.
As evidenced by
Figure 21 and
Figure 22, notable changes in the corresponding coordinate errors are observed before and after optimization using the differential evolution algorithm. Specifically, errors in the corresponding
-coordinate parameters were approximately 1.5 before optimization and reduced to within 0.1 post-optimization. Errors in the corresponding
-coordinates were approximately 0.6 before optimization and reduced to within plus or minus 0.1 afterward. For
-coordinates, errors were within 0.2 before optimization and reduced to within 0.05 after optimization. It is evident that prior to optimization, error fluctuations were significant, whereas a substantial reduction in errors was observed following optimization.
Upon comparison with the DE algorithm, it is noted that there is not a significant disparity in the fitness curves of the two algorithms. In light of this observation, additional experiments were conducted wherein the fitness curves of both algorithms were juxtaposed. The experiments were conducted over 200 iterations, yielding the following results (
Figure 23):
Specific indicators are shown in
Table 6:
The examination of the referenced charts reveals that the IDEPSO achieves a more rapid convergence compared to DE. It is observed that the proposed algorithm approaches stability after 84 iterations, exhibiting a stable fitness value of 1.04068, whereas the stability for the DE algorithm is reached after 128 iterations with a fitness value of 1.04488. In the context of mean-square errors (MSE) across various axes, it is evident that post-optimization, the algorithm we introduced demonstrates significantly reduced MSE values on all axes when juxtaposed with the DE algorithm. Furthermore, the enhanced Differential Evolution Particle Swarm Optimization (DEPSO) algorithm yields a mere 0.1690 root-mean-square error in the x-axis, 0.3780 in the y-axis, and 0.0638 in the z-axis. These calibration results undercut the calibration errors associated with the other three optimization calibration methods, substantiating the exemplary performance and high accuracy of our algorithm.