Dual-frequency fringe projection techniques have been broadly utilized for three-dimensional (3D) shape recovery. However, a pervasive challenge across these methodologies lies in the precise implementation of high-speed measurements. This paper explores a spatial coding strategy designed for the dual-frequency phase unwrapping method to tackle this. The strategy mandates the utilization of only four patterns, encapsulating the phase information of both high and low frequencies. The codewords are strategically embedded within the low-frequency phase, facilitating the acquisition of an accurate absolute phase map. A robust decoding algorithm engineered to ensure dependable phase unwrapping, particularly in scenarios characterized by a substantial number of high-frequency cycles. The proposed method exhibits superior noise immunity and enhances accuracy when compared with the previous dual-frequency phase-shifting methodology. Simulations and experiments demonstrate the robustness and efficiency of the proposed strategy.