We introduce a method of phase demodulation to distinguish the ghost reflection commonly observed in optical testing. The method digitally processes a sequence of fringe patterns to separate the reflections from the front and rear surfaces. First, we use a phase-shifting algorithm to compute an analytic signal with the two reflections coupled, and then we decouple them through maximized spatial filtering. The process requires the acquisition of at least three fringe patterns, as well as fulfilling opposite signs for the magnifications of the two reflections. We demonstrate the decoding process through a real phase measuring deflectometry data processing example.