Uneven surface quality often occurs when butt welds are manually grinding, so robotic weld grinding automation has become a fast-developing trend. Weld seam extraction and trajectory planning are important for automatic control of grinding process. However, most of the research on weld extraction is focused on before welding. Due to the irregular shape of the weld after welding, and too little work has been devoted to the weld identification after welding. Consequently, in this paper, a novel simple and efficient weld extraction algorithm is proposed, and the robot grinding path is planned. Firstly, a new flexible bracket structure for welding seam extraction is designed. Secondly, the weld seam section profile model is established, and the processing of spatial point cloud problem is transformed into the processing of two-dimensional point cloud problem. The least square method (LSM) based on threshold comparison is used to segment the weld seam, which greatly improved the processing speed and accuracy. Then the grinding path and pose are obtained according to the extracted weld space structure. Finally, a robotic welding seam automatic grinding system is built. Experiments show that the proposed method could well extract the irregular weld contour after welding and the grinding system built is reliable, which greatly improves the grinding efficiency.