Crack formation is a common phenomenon in engineering structures, which can cause serious damage to the safety and health of these structures. An important method of ensuring the safety and health of engineered structures is the prompt detection of cracks. Image threshold segmentation based on machine vision is a crucial technology for crack detection. Threshold segmentation can separate the crack area from the background, providing convenience for more accurate measurement and evaluation of the crack condition and location. The segmentation of cracks in complex scenes is a challenging task, and this goal can be achieved by means of multilevel thresholding. The arithmetic-geometric divergence combines the advantages of the arithmetic mean and the geometric mean in probability measures, enabling a more precise capture of the local features of an image in image processing. In this paper, a multilevel thresholding method for crack image segmentation based on the minimum arithmetic-geometric divergence is proposed. To address the issue of time complexity in multilevel thresholding, an enhanced particle swarm optimization algorithm with local stochastic perturbation is proposed. In crack detection, the thresholding criterion function based on the minimum arithmetic-geometric divergence can adaptively determine the thresholds according to the distribution characteristics of pixel values in the image. The proposed enhanced particle swarm optimization algorithm can increase the diversity of candidate solutions and enhance the global convergence performance of the algorithm. The proposed method for crack image segmentation is compared with seven state-of-the-art multilevel thresholding methods based on several metrics, including RMSE, PSNR, SSIM, FSIM, and computation time. The experimental results show that the proposed method outperforms several competing methods in terms of these metrics.