In a scanning electron microscope, slimming is reduced by reducing a frame count. As the frame count is reduced, the amount of detected secondary electrons decreases, so that a probe current amount is increased to emit an increased amount of detected secondary electrons. A primary electron beam is scanned on a sample, a histogram is created, and the histogram is second-order differentiated to calculate a level of halftone at which a sample image changes in contrast, and to calculate the probe current amount. By adjusting the frame count suitable for the calculated probe current amount, and the contrast suitable for the sample image, the slimming of the sample is limited, and a highly visible sample image is generated for length measurement.