1. An image processing apparatus comprising: a splitting unit that splits each of two images into a plurality of regions; an extracting unit that extracts a first value indicating the highest similarity in an array, in the array values indicating similarity between corresponding split images between the two images are arranged, and that extracts a second value indicating highest similarity after excluding similarity in an area including a position of the first value from targets; and a controlling unit that controls to perform position alignment of the two images by excluding a value, of the values indicating the similarity of each of the split images, indicating similarity, a difference between the first value and the second value is less than or equal to a predetermined threshold in the similarity.