1. A measurement apparatus for measuring a three-dimensional shape of an object using a plurality of space encoding patterns each of which includes a light portion and a dark portion, the apparatus comprising: an obtaining unit configured to obtain a first pattern set comprising patterns each of which has the light portion of each space encoding pattern masked by a predetermined pattern mask, and a second pattern set comprising patterns each of which has the light portion of each of the space encoding pattern masked by a mask with varying the predetermined pattern; an input unit configured to input, from a capturing device, captured images of an object to be measured on which the patterns of the first and second pattern sets are sequentially projected by a projection device; a detection unit configured to detect a correspondence between projection coordinates of the projected pattern and image coordinates of a captured image for the projected pattern; and a derivation unit configured to derive a three-dimensional shape of the object to be measured based on correspondences detected by the detection unit.