1. An information processing apparatus comprising: a projection unit configured to project, onto a target object, a projection pattern that includes a measurement pattern for measuring a distance to the target object, and a code pattern for identifying the measurement pattern; a sensing unit configured to sense the target object onto which the projection pattern has been projected; a change unit configured to determine a changed projection pattern as a determined projection pattern to be projected thereafter, on the basis of a relationship between the measurement pattern and the code pattern in a sensed image that has been sensed by the sensing unit; an identification unit configured to read out the code pattern in a sensed image of the target object onto which the determined projection pattern by the change unit has been projected, and to identify the measurement pattern in the determined projection pattern in the sensed image of the target object onto which the determined projection pattern has been projected, based on the read out code pattern; and an acquisition unit configured to acquire, using the identified measurement pattern, a distance from the projection unit or the sensing unit to the target object.