Abstract:In order to reduce the time of matching template selection,a novel algorithm based on sub-image coding by comparison of gray scale is presented.Firstly,every sub-image was divided into 2×2 blocks equally.Then,by comparing the gray scale of the 4×4 blocks including the sub-image and its neighborhood,an 80-bits-binary-code is given to this sub-image.The next step is to find out the least repeated code and chose the obverse sub-image or the sub-images with the highest image variance as the image matching template.Verified by time analyses and simulation experiments,the aforementioned algorithm has less time complexity than several commonly used algorithms.