1. A template matching method, comprising the steps of: obtaining a threshold value used as a similarity evaluation measure by using image data values of pixels in a template image and image data values of pixels in a sub-image to be processed, of which the size is equal to the size of said template image, of a search image; obtaining a square of a difference between an image data value of a pixel in said sub-image to be processed, and an image data value of a corresponding pixel in said template image; performing cumulative addition for said obtained square; and repeating the step of obtaining a square and the step of performing cumulative addition; wherein if a result of said cumulative addition exceeds said threshold value, evaluation of a similarity for said sub-image is closed.