A device for measuring a three-dimensional shape includes an imaging unit which sequentially outputs a first two-dimensional image being captured and outputs a second two-dimensional image according to an output instruction, the second two-dimensional image having a setting different from a setting of the first two-dimensional image, an output instruction generation unit which generates the output instruction based on a shape defect ratio obtained by generating a three-dimensional model based on the second two-dimensional image outputted by the imaging unit and viewing a three-dimensional model from a viewpoint at which the first two-dimensional image is captured, and a storage unit which stores the second two-dimensional image outputted by the imaging unit.