1. An image processing apparatus for identifying an object in an input image, comprising: a memory; and a processor which executes a program stored in the memory to function as: a calculation unit configured to obtain a degree of similarity between corresponding local feature amounts out of a plurality of local feature amounts of the object in the input image and a plurality of local feature amounts of an object in an image registered in advance; an obtaining unit configured to obtain a difference between a capturing condition for the object in the input image and a capturing condition for the object in the registered image; a selection unit configured to select, from degrees of similarity obtained by the calculation unit, degrees of similarity in a number according to the difference from a higher rank in descending order of the degree of similarity, wherein the selection unit selects a smaller number of degrees of similarity as the difference becomes larger; a derivation unit configured to derive one degree of similarity from the selected degrees of similarity; and a determination unit configured to determine, based on the one degree of similarity derived by the derivation unit, whether the object in the input image belongs to the same category as the object in the registered image.