how to use template matching for high-resolution