1. An image processing apparatus comprising: image data input means for inputting captured multiple images; detection image generation means for generating, based on the input images, smaller images by scaling down a certain area of the images; multi-resolution image data storage means for storing multi-resolution image data of the smaller images up to a predetermined resolution level such that each of the multi=resolution image can be identified as to whether a reference image or a target image; and motion data calculation means for calculating motion data between the reference image and the target image by using the multi-resolution image data, wherein the motion data calculating means has: a whole-range matching section for, with regard to image data of a lowest resolution L to a predetermined resolution M (M≦L) of the plural resolution levels of the reference image and the target image previously defined, performing a matching process on all image coordinates in a predetermined range of the reference images and calculating motion data of parallel movement between the reference image and the target image based on an energy function whose arguments are the coordinates on the reference images and the target images by using local lightness image produced by calculating a relative lightness of a pixel to the average lightness of the pixel and the surroundings based on a constant that determines the size of a local area; and a motion data calculating section for, with regard to image data of a resolution level higher than the predetermined resolution M, calculating affine parameters with a multi-degree of freedom as motion data between the reference images and target images by performing a block matching process using the motion data calculated by the whole-range matching section.