An image processing apparatus comprising: a difference calculation unit (51,115) that calculates a difference value indicating a difference between a feature amount of a predetermined region of a frame of image data taken by and output by an image capturing unit capturing a subject and a feature amount of the predetermined region of a past frame relative to the frame of the image data, said image capturing unit having a rolling shutter under illumination by a light source blinking at a predetermined frequency, a first counting unit that counts number of times when an absolute value of the difference value calculated by the difference value calculation unit exceeds a threshold during a predetermined period of time; a second counting unit that counts number of times when the difference value calculated by the difference value calculation unit on a present frame of the image data and the difference value calculated by the difference value calculation unit on a past frame of the image data have different plus-minus signs from each other during a predetermined period of time; an identification unit that compares the number of times counted by the second counting unit with a predetermined value when the number of times counted by the first counting unit exceeds a predetermined value, and based on a comparison result thus obtained, identifies a light source frequency of the light source under which the subject is captured, a setting unit that sets a setting for canceling flicker corresponding to the light source frequency identified by the identification unit to the image capturing unit, characterized in that the image processing apparatus further comprises a detection unit that acquires an exposure value of the present frame from the image capturing unit, and detects a change of the acquired exposure value of the present frame from an exposure value of the past frame having been acquired from the image capturing unit, wherein the setting unit does not set the setting for canceling flicker when the detection unit detects the change within the predetermined period of time. a difference calculation unit (51,115) that calculates a difference value indicating a difference between a feature amount of a predetermined region of a frame of image data taken by and output by an image capturing unit capturing a subject and a feature amount of the predetermined region of a past frame relative to the frame of the image data, said image capturing unit having a rolling shutter under illumination by a light source blinking at a predetermined frequency, a first counting unit that counts number of times when an absolute value of the difference value calculated by the difference value calculation unit exceeds a threshold during a predetermined period of time; a second counting unit that counts number of times when the difference value calculated by the difference value calculation unit on a present frame of the image data and the difference value calculated by the difference value calculation unit on a past frame of the image data have different plus-minus signs from each other during a predetermined period of time; an identification unit that compares the number of times counted by the second counting unit with a predetermined value when the number of times counted by the first counting unit exceeds a predetermined value, and based on a comparison result thus obtained, identifies a light source frequency of the light source under which the subject is captured, a setting unit that sets a setting for canceling flicker corresponding to the light source frequency identified by the identification unit to the image capturing unit, characterized in that the image processing apparatus further comprises a detection unit that acquires an exposure value of the present frame from the image capturing unit, and detects a change of the acquired exposure value of the present frame from an exposure value of the past frame having been acquired from the image capturing unit, wherein the setting unit does not set the setting for canceling flicker when the detection unit detects the change within the predetermined period of time.