1. An image processing apparatus comprising: a processor; and a memory storing instructions that, when executed by the processor, cause the image processing apparatus to: obtain a local feature amount at a feature point in an image by performing rotation correction by a rotation correction amount, and, after the rotation correction, calculating the local feature amount at the feature point; obtain a plurality of pairs of feature points, wherein a pair of feature points includes a feature point in a first image and a feature point in a second image, and the plurality of pairs include a first pair and a second pair; and determine a similarity between the first image and the second image using the obtained plurality of pairs based on a RANSAC method, through: calculating a first difference between the rotation correction amount, which was used in calculating the local feature amount at the feature point, included in the first pair, in the first image, and the rotation correction amount, which was used in calculating the local feature amount at the feature point, included in the second pair, in the first image; and determining, based on the first difference, whether to use the first pair and the second pair as two pairs in derivation of a function for transforming coordinates of a feature point in the second image into coordinates of a corresponding feature point in the first image in the RANSAC method.