1. A three-dimensional-shape measurement apparatus comprising: one or more processors; and one or more memories coupled to the one or more processors and having instructions stored thereon which, when executed by the one or more processors, cause the three-dimensional-shape measurement apparatus to: acquire first captured images of a space onto which a first pattern formed from a bright portion and a dark portion has been projected; acquire second captured images of the space onto which has been projected a second pattern formed from a bright portion and a dark portion and having a boundary position between the bright portion and the dark portion that is different from a boundary position between the bright portion and the dark portion of the first pattern; select, for each of at least one predetermined region of the first captured images or the second captured images, based on a luminance value in the first captured images and a luminance value in the second captured images, one of the first captured images and the second captured images containing the at least one predetermined region as a selection image to be used for three-dimensional-shape measurement; and perform three-dimensional-shape measurement of an object included in the space based on the selection image, wherein the first captured images include a first non-inverted image as a captured image of the space onto which the first pattern has been projected and a first inverted image as a captured image of the space onto which a first reversed pattern obtained by inverting the bright portion and the dark portion of the first pattern has been projected, and wherein the second captured images include a second non-inverted image as a captured image of the space onto which the second pattern has been projected and a second inverted image as a captured image of the space onto which a second reversed pattern obtained by inverting the bright portion and the dark portion of the second pattern has been projected.