The Time of Flight Diffraction (TOFD) method stands as a highly efficient, cost-effective, and environmentally friendly approach for defect detection within the domain of ultrasonic testing. This method proves particularly efficacious in discerning weld seam defects within mechanical welded structures. The D-scan image assumes a pivotal role in detecting flaws within low-alloy thick plate butt welds. In D-scan images, a considerable portion of the data, under reasonable scanning depths, serves as background rather than conveying defect information. This background, primarily noise, acts as non-target interference and significantly disrupts defect identification. Particularly, when the probe detection angle approaches the surface, lateral waves emerge as relatively stable and continuously distributed noise in the image, characterized by trailing tails in time. This characteristic makes them susceptible to overlapping with signals from nearsurface defects, resulting in blind spots during detection. To enhance the clarity of D-scan images, this paper introduces an expeditious and potent technique for lateral wave straightening and removal. the proposed method relies on the peak detection to A-scan and correlation analysis of A-scan signals for the meticulous rectification of D-scan signals. Moreover, it incorporates an insightful examination of image energy distribution and one-dimensional wavelet transform to effectively remove lateral waves, facilitating the generation of clear and discernible images of weld seam defects.