1. An image generation device comprising: a light projector for projecting pattern light of a near-infrared wavelength into an imaging space at intervals of a predetermined number of frame periods; an imager for imaging an object in the imaging space and outputting an imaging signal including an R signal, a G signal, and a B signal respectively representing an R component, a G component, and a B component of an imaged image, the object being illuminated by ambient light and subjected to projection of the pattern light at intervals of the predetermined number of frame periods; a controller for providing the light projector with an instruction on a projection intensity of the pattern light; an image difference acquisition unit for generating a pattern light image by obtaining a difference between the imaging signal obtained when the pattern light is projected and the imaging signal obtained when the pattern light is not projected, of the imaging signal obtained by imaging by the imager, and generating an ambient light image from the imaging signal obtained when the pattern light is not projected; an ambient light type determiner for determining a type of the ambient light; and a visible light image generator for generating, from the type of the ambient light determined by the ambient light type determiner, component ratio information indicating a component ratio of light of a near-infrared wavelength included in the ambient light, estimating a component due to the light of the near-infrared wavelength included in the ambient light in the ambient light image on a basis of the generated component ratio information, and generating a visible light image by subtracting the component due to the light of the near-infrared wavelength from the ambient light image, wherein the ambient light type determiner determines the type of the ambient light from a proportion of R, G, and B components in the imaged image, the ambient light image, or the visible light image.