1. An image processing device comprising: an image receiving means for receiving a first photographic image and a second photographic image of a same examination object, the first and second photographic images being imaged at imaging times different from each other; an edge identification means for identifying an edge of a predetermined part among parts that form the subject in the first photographic image; a first processing means for (1a) determining a plurality of first reference image portions in the first photographic image each of which is composed of a first same number of pixels and has a same first predetermined shape, (1b) determining a plurality of first search ranges in the second photographic image each of which is composed of more than the first same number of pixels, and which have respectively centers at a plurality of positions in the second photographic image corresponding to positions of centers of the same first predetermined shapes of the plurality of first reference image portions respectively, (1c) obtaining two or more first comparison image portions in each of the plurality of first search ranges each first comparison image portion of which is composed of a same number of pixels as the first same number of pixels in each of the plurality of first reference image portions and has the same first predetermined shape, (1d) comparing pixel values of pixels in each of the two or more first comparison image portions in the each of the plurality of first search ranges, with pixel values of pixels in one of the plurality of first reference image portions that has a center at a position in the first photographic image corresponding to a position of a center of the each of the plurality of first search ranges, (1e) determining, as a first matching image portion, one of the two or more first comparison image portions which gives the best agreement with the one of the plurality of first reference image portions, of the two or more first comparison image portions, (1f) obtaining a first vector which connects a center of the first matching image portion and the center of the each of the plurality of first search ranges, and (1g) performing a first matching processing on the second photographic image to match the second photographic image with the first photographic image by locally deforming the second photographic image by amounts of local deformation along local deformation directions each of which is calculated by using the obtained first vector; and a second processing means for means for (2a-1) obtaining one or more first reference image portions through which the edge identified by the edge identification means passes, of the plurality of first reference image portions, (2a-2) determining one or more second reference image portions in the first photographic image each of which is composed of a second same number of pixels and has a same second predetermined shape, the second same number of pixels being less than the first same number of pixels and the one or more second reference image portions having centers at same positions as positions of centers of the one or more first reference image portions respectively, (2b) determining one or more second search ranges in the second photographic image each of which is composed of more than the second same number of pixels, and which have respectively centers at one or more positions in the second photographic image corresponding to positions of centers of the same second predetermined shapes of the one or more second reference image portions respectively, (2c) obtaining two or more second comparison image portions in each of the one or more second search ranges each second comparison image portion of which is composed of a same number of pixels as the second same number of pixels in each of the one or more second reference image portions and has the same second predetermined shape, (2d) comparing pixel values of pixels in each of the two or more second comparison image portions in the each of the one or more second search ranges, with pixel values of pixels in one of the one or more second reference image portions that has a center at a position in the first photographic image corresponding to a position of a center of the each of the one or more second search ranges, (2e) determining, as a second matching image portion, one of the two or more second comparison image portions which gave the best agreement with the one of the one or more second reference image portions, of the two or more second comparison image portions, (2f) obtaining a second vector which connects a center of the second matching image portion and the center of the each of the one or more second search ranges, and (2g) performing a second matching processing on the second photographic image to match the second photographic image with the first photographic image by locally deforming the second photographic image by amounts of local deformation along local deformation directions each of which is calculated by using the obtained second vector.