Light-spots centroid positions detection is one of the major error sources in the application of Hartmann-Shack (H-S) wavefront sensors. The double images (ghosting) in part of sub-aperture, caused by multiple reflections from optical elements or paraxial stray light from operating environment, result in centroid detection errors and that the precisions of wavefront aberration reconstruction decline. The conventional threshold method often leads to the loss of available information of light-spots, though, by which ghosting can been brought under effective control. In this paper, an improved method and procedure, aiming at ghosting detection and local removal automatically, is proposed by combining several algorithms which include nonlinear processing, autocorrelation, convolution, and local filtering, and so on. Then, the corresponding research has been carried out by a numerical simulation platform established by ourselves, and the results can show that this method and procedure is effective.