The objective of the present invention is to acquire an image in which flicker and brightness irregularities are reduced and the depth of field is extended. An endoscope system comprises: a mask generation means (42) which calculates the contrast for each pixel of a pair of images, captured at the same time, of two optical images with different focal points of a segmented subject image and generates a synthetic mask that represents the synthetic ratio of corresponding pixels between the pair of images on the basis of the contrast ratio a mask correction means (44) which generates a correction mask by performing weighted averaging, per pixel, on a plurality of synthetic masks generated for a plurality of pairs of images acquired in time series and an image synthesis means (45) which synthesizes two images according to the correction mask. The mask correction means performs weighted averaging on the plurality of synthetic masks so that the rate of past synthetic masks is higher for pixels that constitute a static region and a region having a contrast less than a predetermined threshold out of the pair of images than for pixels that constitute a dynamic region or a region having a contrast of a predetermined threshold or greater out of the pair of images.Lobjectif de la présente invention est dacquérir une image dans laquelle le papillotement et les irrégularités de luminosité sont réduits et la profondeur de champ est étendue. Un système dendoscope comprend : un moyen de génération de masque (42) qui calcule le contraste pour chaque pixel dune paire dimages, capturées en même temps, de deux images optiques ayant différents foyers dune image de sujet segmentée et génère un masque synthétique qui représente le rapport synthétique de pixels correspondants entre la paire dimages sur la base du rapport de contraste un moyen de correction de masque (44) qui génère un masque de correction en effectuant un calcul de moyenne pondérée, par pixel, sur une pluralité de masques s