An image is obtained. At least one local region is set in the image. Feature patterns are extracted from the local region, and, out of a plurality of bins corresponding to a plurality of patterns which can form the feature patterns, bins that have been determined in accordance with a type of the local region are set as histogram bins used in generating a histogram. A histogram is generated corresponding to the extracted feature patterns using the set histogram bins, and image recognition is performed using the generated histogram.