Detecting the displacement of periodic patterns