1. A method for measuring a three-dimensional shape of an object to be measured after performing a focus adjustment with respect to the object to be measured, by using a non-contact three-dimensional shape measuring apparatus having a predetermined measurement depth including a front position and a rear position with respect to a focus position, as measurement dimensions, the method comprising, in performing the focus adjustment: repeating an operation of acquiring a two-dimensional image concerning the object to be measured by projecting predetermined pattern light onto the object to be measured and by receiving light reflected thereon, and an operation of calculating an imaging contrast on a plurality of areas of the acquired two-dimensional image a predetermined number of times, with a focal length of the three-dimensional shape measuring apparatus being changed each time the acquiring operation and the calculating operation are performed; extracting a high contrast area where the imaging contrast exceeds a predetermined threshold value with respect to each of the two-dimensional images acquired at the different focal lengths; acquiring distance information concerning the object to be measured by triangulation, based on a position on the object to be measured corresponding to the high contrast area, a light projecting position, and a light receiving position; and performing a position adjustment of the measurement dimensions with respect to the object to be measured, based on the distance information.