The invention provides a shape-based
template matching method, and belongs to the technical field of
machine vision, and the method comprises the steps: obtaining a plurality of template images with different scales and angles; respectively calculating the gradient, the
feature vector and the feature point at each pixel point on each template image; for a test image, calculating feature vectors and feature points of the test image, performing
gradient direction expansion on each feature point to obtain a
gradient direction quantized value, and enabling the
gradient direction quantized value to correspond to a unique binary character string; a plurality of lookup tables are created, the index number of each
lookup table corresponds to each binary character string, and the index value corresponds to the cosine value of the feature point and the
feature vector corresponding to the binary character string; extracting template images and feature information of the template images, performing sliding window matching on the template images on the test images in the
horizontal and vertical directions, acquiring overall similarity, and judging whether the test images are successfully matched with the corresponding template images or not; according to the invention, the matching speed and accuracy can be effectively improved.