Template Matching using Statistical Model and Parametric Template for Multi-Template

This paper represents a template matching using statistical model and parametric template for multi-template. This algorithm consists of two phases: training and matching phases. In the training phase, the statistical model created by principal component analysis method (PCA) can be used to synthesize multi-template. The advantage of PCA is to reduce the variances of multi-template. In the matching phase, the normalized cross correlation (NCC) is employed to find the candidates in inspection images. The relationship between image block and multi-template is built to use parametric template method. Results show that the proposed method is more efficient than the conventional template matching and parametric template. Furthermore, the proposed method is more robust than conventional template method.


Introduction
Template matching is an essential task in image processing in many applications, including remote sensing, computer vision, medical imaging, and industrial inspection.Many template matching approaches have been proposed over the past few decades.The NCC is widely used in template matching, but it is time consuming.Tsai and Lin [1] proposed a sum-table scheme to reduce the computation cost for NCC method.In addition, the traditional NCC method is applied in the case of single template; therefore, Tanaka and Sano [2] proposed a parametric template method for template matching.In this method, the parametric space is constructed from the given vertex images (multi-template) that contain rotation and scale variances, but it is a time consuming method.Lin and Chen [3] proposed parametric template vector for template matching with translation, rotation, and scale invariance using the ring-projection transform, but the rotation angle cannot be estimated.They [4] further introduced a sub-pixel template matching with rotation invariance using the parametric template and the ring-projection transform methods.It relies on the ring projection vectors of the eight neighbors around the matching point to estimate the sub-pixel position, but the rotation angle also cannot be estimated.However, the traditional NCC and the parametric template method are time consuming for multi-template.Bukovec, Spiclin, Pernus and Likar [5,6] proposed the geometrical and the statistical methods to detect the surface defect of imprinted tablets that generates by imprinted shape and PCA method from a priori tablet data.Mozina, Tomazevic, Pernus and Likar [7] proposed a statistical method to inspect the imprint quality that incorporates the rotation information.
In this paper, template matching using statistical model and parametric template for multi-template is proposed.The statistical model is used to synthesize the varied templates; consequently, parametric template is employed to measure the similarity between the varied templates and image block.The aim of this paper is to improve the efficiency and the robustness of the similarity measurement for multi-template.
The rest of this paper is organized as follows: Section 2 provides the architecture of proposed algorithm for the template matching.Section 3 shows the detail of each procedure in the proposed algorithm.Section 4 discusses the experimental results of the proposed algorithm.Finally, conclusions are presented in Section 5.

The Architecture of Proposed Template Matching Algorithm
The architecture of the proposed template matching algorithm is shown in Figure 1.The proposed method includes two phases: (1) the training phase and (2) the matching phase.In the training phase, the statistical model is obtained via PCA method.The appearance model is reconstructed by the any specified template and fed into the matching phase, which combines the entire feature from difference templates.In the matching phase, the NCC method is used to find out the optimal location of the object that is most similar to the appearance model, and the image block is generated by optimal location in the inspection images.Then, the parametric parameters are calculated by the multi-template and the image block with the original template images is synthesized to estimate the final NCC.The detail of the proposed method has been discussed in following subsections.

Statistical Model
In training phase, the statistical model is derived from a priori template database, which contains multi-template.
The PCA is used for the statistical model, as defined by where the statistical model is generated from a set of n template images, ; ,..., 0 n u u u is the mean of multi-template; the matrix of variations and corresponding parameters . is a set of linear independent eigenvectors, obtained from covariance matrix , so-called eigenspace .Subsequently, the eigenvectors are calculated by singular value decomposition [8] of a covariance matrix : where u is a set of normalized template images: where n is account of the multi-template.The appearance model of , a specified template, can be approximated by t most significant eigen-vectors: where t is t most significant eigenvectors of ; t is the corresponding approximation parameters, i.e. projection components of A u u) to the corresponding t eigenvectors.The complete appearance model will be constructed for the matching phase as a template in the NCC method.

Normalized Cross Correlation
Here, the NCC method has been used to estimate the similarity between appearance model and inspection image block.The appearance model is applied in a large inspection image by sliding the template window in a pixel-by-pixel basis, and the NCC value is further computed.The maximum values or peaks of the computed correlation values indicate the matching between the appearance model of size , , and the windowed search image of the inspection image which size is , in the size of .The NCC is defined as where the size of the appearance model is ; n m I and T are the gray-level means of the appearance model and the windowed search image, respectively, i.e., 1 1 1 ( , ) ( , ) The optimum location (x, y) will be got when the NCC value is a maximum value.And then the corresponding image block g is segmented.

Parametric Template
In this paper, the parametric template is employed for the calculation of similarity measure between the variant templates and the image block.The parametric template space is constructed from a given set of multi-template.The parametric template is a set of linear parameters i  that satisfies the condition of .Therefore, each template in parametric template space is uniquely represented by parameter i  .A parametric template T with linear parameters where refers to norm of a given function.To consider the maximum of the similarity coefficient between T and the evaluated image, this can be solved by the Lagrange multiplier method.The solution where ω , , , and are The term denotes the dot product between and .The normalized cross correlation matrix is among the multi-template.The correlation vector , includes normalized cross correlation values between an evaluated image block and multi-template, can be calculated by Equation (5).The synthesized NCC value

Procedures of the Proposed Algorithm
The procedures of proposed template matching using statistical model and parametric template for multi-template are illustrated as following.
Step 1: Generating the statistical model from a set of multi-template.
Step 2: Appearance model is generated by any specified template.
Step 3: Using NCC method to find the maximum NCC coefficient sliding over the inspection images.This optimal match position will be used in step 4.
Step 4: The image block g is constructed by the op- timal match position.Then it is applied to calculate the normalized cross correlation vector G  .
Step 5: Using Equation ( 8) to determine the parameter   of parametric template.

Experimental Results
The proposed method was applied to the LED die images were carried out two kinds of test images for the performance evaluation.Figure 2 and Figure 3 showed two cases of the original inspection images; the sizes of these two inspection images are 250  220 and 220  220, respectively.Figure 4 and Figure 5 showed two cases of the template images with illumination changes, and their sizes are 114  76 and 114  50, respectively.In this experiment, the NCC coefficient is used to evaluate the performance outperform the traditional NCC and the parametric method.The experiments were performed with MATLAB 2010a on Intel core Pentium D CPU 3.40 GHz with 3.25GB of memory.
In the experiment, Case 1 and Case 2, the numbers of multi-template are 5 and 9 respectively.The appearance model is shown in Figures 6(a)-(b).The results of the proposed method are shown in Figures 7(a)-(c) and Figures 8(a)-(c), respectively.There are 10 and 15 inspection images in Case1 and Case 2, respectively.Next, two kinds of the performance indices which are the NCC coefficient and the execute time will be shown.The NCC coefficient results are illustrated in Figures 9(a)-(b), respectively.In the traditional NCC method, the NCC coefficient is obtained from different templates; therefore, they individually have a maximum and a minimum NCC coefficient compared to 5 templates in Case 1 and 9 templates in Case 2. Figures 9(a)-(b) show that the frustrations 0.079 exists in index 9 of Case 1; while 0.065 exists in index 14 of Case 2. And the experimental results show that the proposed method is more robust than the traditional NCC method against the illumination change.In order to demonstrate the improved performance of our proposed algorithm, the following example in Case 1 is shown; the different templates, column 2 and 3 in Figure 4, and the inspection image in row 2, column 4 in Figure 2, are used to estimate the NCC coefficient using traditional NCC; the NCC coefficients are 0.775 and 0.854, respectively.The NCC coefficient of the proposed method is 0.873.The results show that the proposed method is more robust under clutter environment.
The computation efficiency for different methods is illustrated in Table 1.Here, the computation time of the proposed method for Case 1 and 2 are 5.68 and 5.03 seconds, respectively.Then the computation time of the traditional NCC and parametric templates in Case 1 and 2 are 29.7,35.2, 40.8 and 50.7 seconds, respectively.Thus, the proposed method indicates the computation advantages for proposed method and traditional NCC and parametric template in Case 1 and 2 being 5.23, 6.2 and 8.1, 10.8 times faster, respectively.In contrast, Table 2 shows the matching locations and scores in detail.The proposed method is verified to be effectively used in real world applications by the above analysis.

Figure 1 .
Figure 1.The architecture of the proposed template matching algorithm.

Figure 8 .
Figure 8. Result of template matching by Case2: (a) Tradiional NCC; (b) Parametric template; (c) Proposed method.t parametric template can be found in terms of the following equation: G 