Anomaly detection based on template image registration is one of the methods used to detect anomalies of objects with similar structures. However, the imaging device of the Electronic Multiple Units (EMU) train is a line-scan camera, and the geometric transformation law between its image and the area-scan image is different. The conventional image registration method of the area-scan image cannot accurately align the line-scan image. Moreover, the line-scan image of the EMU train collected in uncontrollable environmental scenes exhibits significant grayscale changes, and the registered images cannot detect differences by directly comparing grayscale. To address these two challenges, this paper proposes a two-stage anomaly detection method based on line-scan image registration and edge comparison. In the registration stage, a coarse-to-fine line-scan image registration method was designed. First, the feature-based registration method was used to achieve coarse position of the EMU train template image in the target image. Then, the direct registration method based on the line-scan image geometric transformation model achieved precise geometric alignment. In the anomaly detection stage, edge information is extracted from the template image and the registered target image, and anomaly detection of EMU trains is achieved through edge comparison, edge expansion, and edge connection. The experimental results on the line-scan image of EMU trains show that the two-stage method proposed in this paper can achieve the registration of line-scan images of EMU trains, and on this basis, achieve detection and segmentation of abnormal areas of EMU trains.