Aiming at the problems of low efficiency and poor accuracy of the existing methods for anomaly detection of transmission line images taken by UAV aerial photography, an improved phase grouping algorithm is proposed for wire extraction and sliding pixel block model for anomaly detection of transmission lines based on the preprocessing of transmission line images taken by UAV aerial photography. According to the optimal phase division mode of the transmission line and the pseudo wire judgment benchmark, the phase grouping algorithm is optimized, by changing the rotation gradient angle of the sliding pixel block, the accurate location of the transmission line anomaly is determined, and the detection of broken wires and suspended foreign objects is completed. The feasibility of the proposed method is verified by experiments. The results show that, compared with the conventional methods, the proposed wire extraction method has higher accuracy, error detection prevention and operation efficiency, and has higher accuracy and operation efficiency in the detection of wire strand breakage and suspended foreign matters. This research can greatly improve the safety and efficiency of patrol inspection.