White-light scanning interferometry is a mature non-contact three-dimensional shape detection method. However, the batwing effect is an inherent problem that causes systematic error. In this paper, we proposed an algorithm for detecting and eliminating the batwing effect based on the Haar wavelet transforms without any prior knowledge of the sample surface. It is verified by simulation and experiment that the proposed algorithm can effectively eliminate the batwing effect and does not increase the time complexity significantly.