1 | initial version |
As far as I understand you would like to get one similarity value for a whole template matching instead of the array of individual pixel matches. However the main idea of template matching is to slide a small (relative to the image) template through the image and find the highest matching area. See the template matching tutorial here. The resulting image gives a detailed map on how well the template matched in each location.
The following set of images show how well the template matches on the image with different matching methods:
Back to your original question if you are not interested in the exact location of the match just the highest/lowest match value - because you want to find the images on which the template is certainly there - then you can use the minMaxLoc function and compare the maximal/minimal value with a predefined threshold.