An endoscope system includes an endoscope configured to pick up an image of an inside of a subject to acquire an image, and a processor including hardware. The processor estimates a three-dimensional position of a target portion within the subject based on an image, sets for the three-dimensional position a reliability corresponding to a predetermined parameter related to the endoscope system determined when the image is acquired, and selects, when a plurality of three-dimensional positions for the target portion exist, a predetermined three-dimensional position among the plurality of three-dimensional positions depending on the reliability and generates a three-dimensional shape image.