An imaging device comprising: an imaging section (209, 211, 213) that performs imaging by an imaging element in which focus detecting pixels to perform focus detection are disposed at positions of parts of imaging pixels, and outputs image data; an image processor that corrects pixel outputs to be output from the focus detecting pixels in the image data by a correction function; and a control section that allows the imaging section to repeatedly execute an imaging operation, and acquires the image data corresponding to frames, wherein the image processor includes: an optical information acquiring section that acquires optical information of a photographing optical system to form an image in the imaging element; an optical function calculating section that calculates an optical function to determine the correction function based on the optical information, the optical function presenting a relation between coordinates of the focus detecting pixels and pixel outputs from the focus detecting pixels; a pixel function calculating section that calculates a pixel function to determine the correction function based on the pixel outputs of the pixels positioned around the focus detecting pixels, the pixel function presenting a relation between coordinates of the focus detecting pixels and pixel outputs from the focus detecting pixels based on pixel outputs from the imaging pixels; and a correction function selecting section that calculates a reliability of the optical function and a reliability of the pixel function and that selects the optical function or the pixel function as the correction function to correct the pixel output to be output from the focus detecting pixel corresponding to each of the frames, based on the calculated reliability of the optical function and the calculated reliability of the pixel function. an imaging section (209, 211, 213) that performs imaging by an imaging element in which focus detecting pixels to perform focus detection are disposed at positions of parts of imaging pixels, and outputs image data; an image processor that corrects pixel outputs to be output from the focus detecting pixels in the image data by a correction function; and a control section that allows the imaging section to repeatedly execute an imaging operation, and acquires the image data corresponding to frames, wherein the image processor includes: an optical information acquiring section that acquires optical information of a photographing optical system to form an image in the imaging element; an optical function calculating section that calculates an optical function to determine the correction function based on the optical information, the optical function presenting a relation between coordinates of the focus detecting pixels and pixel outputs from the focus detecting pixels; a pixel function calculating section that calculates a pixel function to determine the correction function based on the pixel outputs of the pixels positioned around the focus detecting pixels, the pixel function presenting a relation between coordinates of the focus detecting pixels and pixel outputs from the focus detecting pixels based on pixel outputs from the imaging pixels; and a correction function selecting section that calculates a reliability of the optical function and a reliability of the pixel function and that selects the optical function or the pixel function as the correction function to correct the pixel output to be output from the focus detecting pixel corresponding to each of the frames, based on the calculated reliability of the optical function and the calculated reliability of the pixel function. an optical information acquiring section that acquires optical information of a photographing optical system to form an image in the imaging element; an optical function calculating section that calculates an optical function to determine the correction function based on the optical information, the optical function presenting a relation between coordinates of the focus detecting pixels and pixel outputs from the focus detecting pixels; a pixel function calculating section that calculates a pixel function to determine the correction function based on the pixel outputs of the pixels positioned around the focus detecting pixels, the pixel function presenting a relation between coordinates of the focus detecting pixels and pixel outputs from the focus detecting pixels based on pixel outputs from the imaging pixels; and a correction function selecting section that calculates a reliability of the optical function and a reliability of the pixel function and that selects the optical function or the pixel function as the correction function to correct the pixel output to be output from the focus detecting pixel corresponding to each of the frames, based on the calculated reliability of the optical function and the calculated reliability of the pixel function.