The crack problem in road surface and track beam surface is one of the major security risks in transportation. To detect cracks efficiently with the images collected, a new crack enhancement algorithm based on Electromagnetism-like Mechanism (EM) is proposed according to characteristics of crack images. Local neighborhoods of pixels are divided into strong neighborhood, weak neighborhood and noise points. Parameters (α, β) of in-complete Beta function are searched locally according to the type of each neighborhood, and crack images are enhanced with in-complete function Beta. The idea of Shuffled Frog-Leaping Algorithm (SFLA) is added to the EM Algorithm that combining global information exchange and local information search. To get the optimal enhanced image, the variance of the image is taken as the objective function. Experimental results show that the algorithm proposed is good at crack enhancement (ie. the weak neighborhood is enhanced, and the noise points is eliminated effectively), and crack images enhanced perform better in image segmentation.