1. An image processing apparatus which corrects input image data based on the image data and foreign substance information containing information on a position and size of a foreign substance adhering to an optical element arranged in front of an image sensor in an image capturing apparatus that captures the image data, the apparatus comprising: a correction unit which corrects the image data so as to reduce influence of a shadow of the foreign substance contained in the image data, based on the image data and the foreign substance information; a still image uniformity determination unit which determines uniformity of an image in a region around the foreign substance in the image data, said still image uniformity determination unit being applied when input image data is a still image; a moving image uniformity determination unit which determines the uniformity of the image in the region around the foreign substance in the image data based on a determination criterion different from a determination criterion applied to a still image by said still image uniformity determination unit, said moving image uniformity determination unit being applied when input image data is a moving image; and a control unit which inhibits correction of the image data by said correction unit when either of said still image uniformity determination unit and said moving image uniformity determination unit determines that the uniformity is not larger than a predetermined value.