1. An image processing apparatus comprising: pixel selecting means for selecting pixel values that are provided at each of pixel positions in input images which are arranged in chronological sequence, each of the pixel values being included in a corresponding one of the input images, on the basis of an input image to be processed that is set in the middle of the sequence; moving-object detecting means for detecting a moving object using the selected pixel values, and producing information items concerning the moving object as moving-object information items, wherein the moving-object detecting means calculates, as the moving-object information items, probabilities that the pixel values of the input image to be processed indicate a moving object, and the probabilities for the pixel values of the input image to be processed at each pixel position are calculated based on distances between the pixel values in the input images at the corresponding pixel position, and on a ratio of a number of calculated distances at the corresponding pixel position that are greater than a predetermined threshold and a number of input images that are not the input image to be processed; and output-image generating means for generating pixel values of an output image, each of the pixel values being generated for a corresponding one of the pixel positions by using, in accordance with a corresponding one of the moving-object information items, a corresponding one of pixel values of the input image to be processed.