Patent attributes
An exposure time is changed stepwise, a light receiving amount output from a light receiving section is obtained at each exposure time, which is changed stepwise, and height image data, in which each pixel value indicates a height of each portion of a surface of a measuring object, is generated based on the obtained light receiving amount. It is determined whether each pixel constituting each height image is valid or invalid based on the obtained light receiving amount. An exposure time, which corresponds to a height image in which the number of pixels determined to be valid satisfies a predetermined condition, is set as a set value.