1. An image processing apparatus for obtaining a local feature amount from an image, comprising: an extension unit configured to generate an extended image by extending an edge portion of the image in a prescribed range; a detection unit configured to detect, from the extended image, a plurality of feature points that each indicate a setting position of a local region that specifies a calculation region for the local feature amount; a calculation unit configured to, for each of the feature points in the extended image, set the local region corresponding to the feature point, and calculate a local feature amount corresponding to the feature point based on image information in the local region; an inspection unit configured to inspect the image information in each local region that has been set with respect to the extended region, and determine whether to adopt the local feature amount calculated from the local region based on the inspection result; and an obtaining unit configured to obtain each local feature amount calculated from a region other than the extended region and each local feature amount determined to be adopted by the inspection unit, as local feature amounts in the image.