A reference image of a pattern having a first pitch and projected on a
sample 1 by a projector 6 is captured by a camera 5. Next, a measuring
image of a pattern having a second pitch and projected on the sample 1 by
the projector 6 is captured by the camera 5. Here, the second pitch of
the pattern light is determined by a value calculated based on the phase
resolution of the pattern light having the first pitch. Then, using the
reference image thus obtained, phase coupling for the measuring image is
performed. The three-dimensional shape of the sample is obtained in this
manner.