Patent ID: 8837829

Claim:
An image processing apparatus comprising: a generation unit configured to generate a histogram of luminance values of a plurality of pixels included in an image; a luminance value calculation unit configured to calculate a first luminance value to which a first ratio of the plurality of pixels corresponds in descending order of the luminance values of the histogram, and a second luminance value to which a second ratio of the plurality of pixels corresponds, the second ratio being larger than the first ratio; a selection unit configured to compare the first luminance value and the second luminance value, and determine a third luminance value that is set a maximum luminance value in gradation correction on the basis of a result of the comparing, the selection unit calculating a difference between the first luminance value and second luminance value, setting the second luminance value as the third luminance value when the difference is smaller than a threshold value, and setting a value between the second luminance value and the first luminance value as the third luminance value when the difference is equal to or larger than the threshold value; and a correction unit configured to perform the gradation correction that corrects the luminance values of the plurality of pixels on the basis of the third luminance value and generates a corrected image.