A shape measuring method that projects a pattern onto a measurement target, acquires picture image data by capturing a picture image of an image of the pattern projected onto the measurement target in a direction different from a projection direction of the pattern, and measures the shape of the measurement target based on the image of the pattern of the picture image data, the shape measuring method comprising:
- moving a projected position of the pattern relative to the measurement target;
- setting a region of interest for acquiring information used to measure the measurement target to be in at least part of a region captured by the image capturing unit, so as to include the image of the pattern;
- measuring a shape of the measurement target based on a position of the image of the pattern positioned in the region of interest of the picture image data;
- and
- setting a reference region-of-interest in part of the region captured by the image capturing unit, wherein
- determining whether to set the region of interest based on a state of the image of the pattern in the reference region-of-interest, and setting the region of interest in a case where the image of the pattern is in the reference region-of-interest.