Localization of a single nanosized light emitter has substantial applications in bioimaging. The accuracy and precision of localization are limited by the noise and the heterogeneous background superimposed on the signal. While the effects of noise are well recognized, the influence of background is less addressed. Proper background correction not only provides more accurate localization data but also enhances the sensitivity of detection. Here, we demonstrate a new approach to background correction by estimating and removing the heterogeneous but stationary background from a series of images containing a spatially moving signal. Our approach exploits the correlated signal information encoded in the neighboring pixels governed by the point-spread function of the measurement system. This new approach makes it possible to obtain the background even when the total displacement of the signal is subdiffraction limited throughout the observation, the scenario where previous methods become invalid. We characterize our approach systematically with different types of signal motions at various signal-to-noise ratios in numerical simulations. We then verify our method experimentally by recovering the nanoscopic displacements of single gold nanoparticle moving in a specified pattern and a single virus particle randomly diffusing on a cell surface. The source code of our algorithm written in MATLAB is provided together with a sample data set. Our approach has immediate applications in high-precision optical localization measurements.