In our previous work on image registration we developed a novel image registration method, called the Intensity Combinatorial Minimization Method (ICMM), that has many appealing features. Two important features of this method is that ICMM is computationally efficient and has the unique feature of being invariant to the image processed by an injective function. In this paper we extend the use of ICMM for template matching. The extraction of an optimum template is investigated. Optimization of both template location and template size are addressed. We introduce the Intensity Variation Number, which is an image information measure that is strongly related to entropy. We show that optimization is a function of the Intensity Variation Number. Results of tests conducted on real images with noise are presented that support our theories.