In order to achieve a higher speed for fringe projection profilometry, we propose a quaternary gray-code phase unwrapping method using only two defocused binary patterns. We present a weighted optimization algorithm for the design of special binary code patterns. The designed binary patterns are projected on the object with a defocused projector, and interestingly become quaternary patterns which are more expressive gray codes. After the distorted code patterns are captured by a camera, they will undergo our proposed normalization-denoising-clustering process to recover the ideal gray codes. Besides, continuity/geometry constraints are integrated with this phase unwrapping method to further reduce the number of required patterns. The integrated method can recover a high-quality 3D shape with only five binary patterns including three patterns for three-step phase shifting algorithms and two for our phase unwrapping method. The effectiveness of the proposed method is demonstrated by both simulations and experiments.