A numerical algorithm for fast search of the initial phase shift on phase images with arbitrary stepwise shifts is proposed. The algorithm is based on finding the minimum deviation of the model function from the measurement results. The interval search method used directly in the proposed approach made it possible to significantly reduce the computational complexity of the algorithm. The paper presents the results of measuring a three-dimensional profile by phase triangulation methods using the proposed algorithm. The obtained results confirm the efficiency and high practical value of the proposed phase image decoding algorithm.