To measure the size of target in three-dimensional scene under a single camera, this study uses a three-dimensional environment distance function and optimizes the optical axis parameter OO'. A method of enlarging the measurement range is proposed, which is extended to measuring on the vertical surface. The experiment is based on the Raspberry Pi 3B platform with Raspberry Pi Camera. The results of experiment show that the optimization of OO' improves the measurement accuracy and the method proposed extends the measurement range. The algorithm is simple yet effective and can achieve the performance more flexibly and steadily.