1. A non-transitory computer-readable medium storing an image matching program, which when executed by a computer, directs the computer to perform an image matching method, the image matching method comprising: an extraction process extracting a first feature information including a position of the first image of a portion including a first characteristic structure and extracting a second feature information including a position of the second image of a portion including a second characteristic structure from first and second images, respectively; a first adjustment process adjusting a relative position between the first and second images according to the extracted first and second feature information; a partial image segmentation process dividing the first image into a number of blocks, obtaining a position when the largest correlation value between some of the blocks and at least one ridgeline direction distribution registered in advance is obtained, and segmenting a partial image, which includes the position, of a specified size from the first image; a first searching process moving the partial image on the second image using the relative position adjusted by the first adjustment process, and searching for a position of the partial image where the partial image and the second image including a portion overlapping the partial image indicating a largest overlap; a second adjustment process adjusting a relative position between the second image and the first image using the position searched for by the first searching process; a second searching process moving the whole first image on the whole second image using a relative position adjusted by the second adjustment process, and searching for a position of the first image where the first image and the second image including a portion overlapping the first image indicating a largest overlap; a third adjustment process adjusting a relative position between the second image and the first image using the position searched for by the second searching process; and a determination process determining by correlating the whole first image and the whole second image using an adjustment result of the third adjustment process as to whether or not the first image matches the second image.