<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">JSIP</journal-id><journal-title-group><journal-title>Journal of Signal and Information Processing</journal-title></journal-title-group><issn pub-type="epub">2159-4465</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/jsip.2015.62011</article-id><article-id pub-id-type="publisher-id">JSIP-55307</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  A Robust Template Matching Algorithm Based on Reducing Dimensions
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>.</surname><given-names>M. Fouda</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>College of Computer Science and Information Technology, King Faisal University, Al-Ahsa, Kingdom of Saudi Arabia</addr-line></aff><author-notes><corresp id="cor1">* E-mail:<email>yfoudah@kfu.edu.sa</email></corresp></author-notes><pub-date pub-type="epub"><day>27</day><month>03</month><year>2015</year></pub-date><volume>06</volume><issue>02</issue><fpage>109</fpage><lpage>122</lpage><history><date date-type="received"><day>10</day>	<month>February</month>	<year>2015</year></date><date date-type="rev-recd"><day>accepted</day>	<month>1</month>	<year>April</year>	</date><date date-type="accepted"><day>2</day>	<month>April</month>	<year>2015</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  Template matching is a fundamental problem in pattern recognition, which has wide applications, especially in industrial inspection. In this paper, we propose a 1-D template matching algorithm which is an alternative for 2-D full search block matching algorithms. Our approach consists of three steps. In the first step the images are converted from 2-D into 1-D by summing up the intensity values of the image in two directions horizontal and vertical. In the second step, the template matching is performed among 1-D vectors using the similarity function sum of square difference. Finally, the decision will be taken based on the value of similarity function. Transformation template image and sub-images in the source image from 2-D grey level information into 1-D information vector reduce the dimensionality of the data and accelerate the computations. Experimental results show that the computational time of the proposed approach is faster and performance is better than three basic template matching methods. Moreover, our approach is robust to detect the target object with changes of illumination in the template also when the Gaussian noise added to the source image.
 
</p></abstract><kwd-group><kwd>Image Processing</kwd><kwd> Template Matching</kwd><kwd> Vector Sum</kwd><kwd> Sum of Square Difference</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>One of the most important issues in image analysis is automatically extracting useful information from an image. This information must be explicit and can be used in subsequent decision making processes. The more commonly used image analysis techniques include template matching and statistical pattern recognition. We can classify the types of analysis we wish to perform according to function. There are two main types of functions we will wish to know about the scene in an image. First, we may wish to ascertain whether or not the visual appearance of objects is as it should be, i.e. we may wish to inspect the objects. The implicit assumption here is, of course, that we know what objects are in the image in the first place and approximately where they are. The second function of image analysis is location. If we don’t find out the objects, we may wish to know where they are. The location of an object requires the specification of both horizontal and vertical coordinates. The coordinates may be specified in terms of the image frame of reference where distance is specified in terms of pixels.</p><p>Many of applications of computer vision simply need to know whether an image contains some previously defined object or whether a pre-defined sub-image is contained within a source image. The sub-image is called a template and should be an ideal representation of the pattern or object which is being sought in the image. The template matching technique involves the translations of the template to every possible position in the image and the evaluation of the measure of the match between the template and the image at that position. If the similarity measure is large enough, then the object can be assumed to be present. Various difference measures have different mathematical properties, and different computational properties have been used to find the location of template in the source image. The most popular similarity measures are the sum of absolute differences (SAD), the sum of squared difference (SSD), and the normalized cross correlation (NCC). Because SAD and SSD are computationally fast and algorithms are available which make the template search process even faster, many applications of gray-level image matching use SAD or SSD measures to determine the best match. However, these measures are sensitive to outliers and are not robust to variations in the template, such as those that occur at occluding boundaries in the image. However, although the NCC measure is more accurate, it is computationally slow. It is more robust than SAD and SSD under uniform illumination changes, so the NCC measure has been widely used in object recognition and industrial inspection such as in [<xref ref-type="bibr" rid="scirp.55307-ref1">1</xref>] and [<xref ref-type="bibr" rid="scirp.55307-ref2">2</xref>] . An empirical study of five template matching algorithms in the presence of various image distortions has found that NCC provides the best performance in all image categories [<xref ref-type="bibr" rid="scirp.55307-ref3">3</xref>] .</p><p>Many techniques have been developed to increase the template matching process. Chen and Hung [<xref ref-type="bibr" rid="scirp.55307-ref4">4</xref>] classify these techniques into three classes. First class saves the computations by reducing the number of positions searched. On the other hand, class two try to reduce the computational cost of the matching error for each search position. The techniques in the first and second classes can be combined to further improve the efficiency and this kind of hybrid methods are classified as the third class. Techniques in class one perform the matching error calculations and comparison within a partial search set which is a subset of the complete search set. The efficiency of these techniques depends on the number of the selected search positions, while the resulted minimum matching error depends on how the search positions are selected. Techniques founded in [<xref ref-type="bibr" rid="scirp.55307-ref5">5</xref>] - [<xref ref-type="bibr" rid="scirp.55307-ref7">7</xref>] belong to this class. For example the coarse-to-fine strategy divides the search process into several search steps. Starting from the origin position (0, 0), SADs of several coarsely-spaced search positions are calculated and the one with the minimum SAD is selected as the new starting position of the next step. This procedure is repeated several times with smaller and smaller spacing between the search positions until the search positions with spacing of one pixel are examined. The final search position with minimum SAD is selected as the search result.</p><p>Techniques in class two accelerate the calculation of matching error for each search position. Instead of calculating matching error, SAD, these techniques calculates a partial matching error which need less computation than SAD and whose value is less than or equal to SAD. One simple technique in this class is to subsample the pixels in the matching blocks. For example, the partial sum of absolute difference can be calculated by using a quarter of pixels regularly subsampled in each matching block [<xref ref-type="bibr" rid="scirp.55307-ref8">8</xref>] . Another technique, called the partial distance method [<xref ref-type="bibr" rid="scirp.55307-ref9">9</xref>] and [<xref ref-type="bibr" rid="scirp.55307-ref10">10</xref>] , can be used for speeding up the computation. For each search position, the partial sum of absolute difference is calculated. During the calculation process, if one of these partial sum absolute differences is larger than the minimum matching error computed so far, the calculation for this search position can be terminated and the calculation of the partial sum of absolute difference behind can be saved. The techniques in class three combine the techniques in the previous two classes, as described in [<xref ref-type="bibr" rid="scirp.55307-ref8">8</xref>] and [<xref ref-type="bibr" rid="scirp.55307-ref11">11</xref>] to further improve the efficiency. Another technique in this class is the hierarchical method [<xref ref-type="bibr" rid="scirp.55307-ref12">12</xref>] which first estimates the coarse result of the motion vector in the lower resolution image, and then refines the result in the higher resolution image within a small search region centering at the coarse result.</p><p>Reducing data in the image by converting the image from 2-D into 1-D is a new strategy in template matching introduced by [<xref ref-type="bibr" rid="scirp.55307-ref13">13</xref>] . He used ring projection transform to convert the 2-D template in a circular region into a 1-D gray level signal as a function of radius. Fouda [<xref ref-type="bibr" rid="scirp.55307-ref14">14</xref>] convert the 2-D images into 1-D vector information by summing-up the intensity values in all rows in the vertical direction. His method was sensitive to noise. In this paper, we modify the 1-D template matching algorithm to making it more robust to noise. Instead of the image scanned in one direction we scan the image in two directions to increase the features in the 1-D information vector. Then the matching process can be done under some degree of noise. The rest of the paper is organized as follows. Section 2 introduces the basic techniques in template matching. The description of proposed algorithm and its complexity analysis will be described in Section 3. Simulation and comparison results for NCC, SAD, and coarse-to-fine (CTF) standard are reported in Section 4. Then we state conclusions in Section 5.</p></sec><sec id="s2"><title>2. Template Matching Basic Techniques</title><p>In this section we introduce the most important three algorithms in template matching. Starting by normalized cross correlation technique is computationally expensive. But it is very robust against noise under different illumination conditions, so it has been widely used in object recognition and industrial inspection. The second is the sum of absolute difference algorithm which is best computationally than normalized cross correlation technique. But it is not robust to intensity and contrast variations, so it can be used in some applications such as feature tracking and block motion estimation in video compression. The last is the coarse-to-fine (CTF) technique which can be reduce the computational cost by using block averaging to decrease the spatial resolution of the template and the source image. It apply the low-resolution (“coarse”) template to the low-resolution source, and using the full-resolution (“fine”) template only when the coarse template’s degree of mismatch with the source is blew a given threshold.</p><sec id="s2_1"><title>2.1. Normalized Cross Correlation (NCC)</title><p>NCC has been commonly used as a metric in pattern matching to evaluate the degree of similarity between template and blocks in source image. The main advantage of the NCC over other techniques is that it is less sensitive to linear changes in the amplitude of illumination in the two compared template and block. Furthermore, the NCC is confined in the range between −1 and 1. The setting of detecting threshold is much easier than other techniques. The NCC does not have a simple frequency domain expression. It cannot be directly computed using the more efficient fast Fourier transform in the spectral domain. Its computation time increase dramatically as the window size of the template gets larger [<xref ref-type="bibr" rid="scirp.55307-ref15">15</xref>] .</p><p>In pattern matching applications, NCC working as follows: one finds an instance of a small template in a large source image by sliding the template window in a pixel by pixel basis, and computing the normalized correlation between them. The maximum value or peaks of the computed correlation values indicate the matches between a template and subimage in the source image. <xref ref-type="fig" rid="fig1">Figure 1</xref> shows the surface plot correlation coefficient values between the template T(a) in <xref ref-type="fig" rid="fig5">Figure 5</xref>(a) and blocks in the source image in <xref ref-type="fig" rid="fig4">Figure 4</xref>(a). The experimental results</p><fig id="fig1"  position="float"><label><xref ref-type="fig" rid="fig1">Figure 1</xref></label><caption><title> Surface plot of correlation coefficient between template T(a) in <xref ref-type="fig" rid="fig5">Figure 5</xref>(a) and green image in <xref ref-type="fig" rid="fig4">Figure 4</xref>(a)</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x5.png"/></fig><p>given that the peak value 0.999. This value in the surface at position (200, 175) in the source image is the correct match for template T(a).</p><p>The values of NCC used for finding matches of the template <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x6.png" xlink:type="simple"/></inline-formula> of size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x7.png" xlink:type="simple"/></inline-formula> in a source image <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x8.png" xlink:type="simple"/></inline-formula> of Size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x9.png" xlink:type="simple"/></inline-formula> is defined as:</p><disp-formula id="scirp.55307-formula1045"><label>(1)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x10.png"  xlink:type="simple"/></disp-formula><p>where</p><disp-formula id="scirp.55307-formula1046"><label>(2)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x11.png"  xlink:type="simple"/></disp-formula><p>Direct computation of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x12.png" xlink:type="simple"/></inline-formula> require <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x13.png" xlink:type="simple"/></inline-formula> (addition/ multiplication) operations at each point <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x14.png" xlink:type="simple"/></inline-formula> in the source image where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x15.png" xlink:type="simple"/></inline-formula>,<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x16.png" xlink:type="simple"/></inline-formula>. Then the operations in Equation (1) is proportional to<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x17.png" xlink:type="simple"/></inline-formula>. So the computational cost of NCC is Ο<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x18.png" xlink:type="simple"/></inline-formula>which is very time consuming.</p></sec><sec id="s2_2"><title>2.2. Sum of Absolute Difference (SAD)</title><p>The SAD is another commonly used similarity measure in pattern matching. According to [<xref ref-type="bibr" rid="scirp.55307-ref16">16</xref>] from a maximum likelihood perspective, SAD measure is justified when the additive noise distribution is exponential. Template matching applications often use the similarity measure SAD. However, this measure is not invariant to brightness and contrast variations which occur in many practical problems [<xref ref-type="bibr" rid="scirp.55307-ref17">17</xref>] . SAD is faster than NCC algorithm because it requires neither multiplication nor division operations.</p><p>Assume we have a template image <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x19.png" xlink:type="simple"/></inline-formula> of size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x20.png" xlink:type="simple"/></inline-formula> is to be matched within a source image <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x21.png" xlink:type="simple"/></inline-formula> of Size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x21.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x22.png" xlink:type="simple"/></inline-formula> where (<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x21.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x23.png" xlink:type="simple"/></inline-formula>and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x21.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x24.png" xlink:type="simple"/></inline-formula>). For each pixel location <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x20.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x21.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x22.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x23.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x24.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x25.png" xlink:type="simple"/></inline-formula> in the source image we compute an</p><p><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x26.png" xlink:type="simple"/></inline-formula>matrix <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x27.png" xlink:type="simple"/></inline-formula> where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x26.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x27.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x28.png" xlink:type="simple"/></inline-formula> is of the form</p><disp-formula id="scirp.55307-formula1047"><label>(3)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x29.png"  xlink:type="simple"/></disp-formula><p>where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x30.png" xlink:type="simple"/></inline-formula>, the minimum value of the matrix <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x30.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x31.png" xlink:type="simple"/></inline-formula> given us the location of the best match for the</p><p>template in the source image. If one of the values of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x32.png" xlink:type="simple"/></inline-formula> is zero, the local block is identical to the template. <xref ref-type="fig" rid="fig2">Figure 2</xref> shows the surface plot of matric <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x32.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x33.png" xlink:type="simple"/></inline-formula> when the SAD algorithm search about template T(a) in <xref ref-type="fig" rid="fig7">Figure 7</xref>(a) in the noise image in <xref ref-type="fig" rid="fig6">Figure 6</xref>(b). We notice that the minimum value of matrix <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x32.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x33.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x34.png" xlink:type="simple"/></inline-formula> is 32,384 which gives us the true position (100, 80) for T(a) in the source image.</p><p>The computation of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula> requires a number of operations proportional to the template area<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x36.png" xlink:type="simple"/></inline-formula>. These operations are computed for each <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x36.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x37.png" xlink:type="simple"/></inline-formula> in the source image where<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x36.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x38.png" xlink:type="simple"/></inline-formula>,<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x36.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x38.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x39.png" xlink:type="simple"/></inline-formula>. Then the computational cost for SAD method is Ο<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x36.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x38.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x39.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x40.png" xlink:type="simple"/></inline-formula>the same complexity in NCC algorithm but the SAD method is faster than NCC method because the number of operations (comparison) in SAD is less than number of operations (addition, multiplication, and divisions) in NCC for each position <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x35.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x36.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x37.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x38.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x39.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x40.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x41.png" xlink:type="simple"/></inline-formula> in the source image.</p></sec><sec id="s2_3"><title>2.3. Coarse-to-Fine (CTF)</title><p>The coarse-to-fine strategy, proposed by Rosenfeld and Vander Brug [<xref ref-type="bibr" rid="scirp.55307-ref18">18</xref>] [<xref ref-type="bibr" rid="scirp.55307-ref19">19</xref>] , is well-known approach to reduce the computational cost of template matching. This strategy uses a low resolution template and its corresponding low resolution source image for initial coarse matching. Matching between high resolution template and original source image is applied for fine matching only when there is high similarity in the coarse matching. The coarse-to-fine technique works as follows: Upon creating the resolution levels for both template and source image, a search is conducted with the coarse template and its source image. The resulting pixel location provides a coarse location of the template pattern in the next lower level of the source image. Therefore, instead of per-</p><fig id="fig2"  position="float"><label><xref ref-type="fig" rid="fig2">Figure 2</xref></label><caption><title> Surface plot of sum of absolute difference between template T(a) in <xref ref-type="fig" rid="fig7">Figure 7</xref>(a) and the noise two-man image in <xref ref-type="fig" rid="fig6">Figure 6</xref>(b)</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x42.png"/></fig><p>forming a complete search in the next level resolution, one requires to only search a close vicinity of the area computed from the previous search. This sequence is iterated until the search in the original source image is searched.</p><p>The image resolution levels is based on reducing the dimensions of the image by a factor<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x43.png" xlink:type="simple"/></inline-formula>, a predefined positive integer, at each resolution level. Assume we start with an image <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x43.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x44.png" xlink:type="simple"/></inline-formula> and let <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x43.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x44.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x45.png" xlink:type="simple"/></inline-formula> be the rth level of the resolution levels. The value of a pixel <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x43.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x44.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x45.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x46.png" xlink:type="simple"/></inline-formula> on level r can be obtained from the average values</p><p>of corresponding <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula> neighboring pixels<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula>, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x49.png" xlink:type="simple"/></inline-formula>, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x49.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x50.png" xlink:type="simple"/></inline-formula>, and <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x49.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x50.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x51.png" xlink:type="simple"/></inline-formula> on level<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x49.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x50.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x51.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x52.png" xlink:type="simple"/></inline-formula>. In other words, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x49.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x50.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x51.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x52.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x53.png" xlink:type="simple"/></inline-formula>can be obtained by the following equation when<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x47.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x48.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x49.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x50.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x51.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x52.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x53.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x54.png" xlink:type="simple"/></inline-formula>:</p><disp-formula id="scirp.55307-formula1048"><label>(4)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x55.png"  xlink:type="simple"/></disp-formula><p><xref ref-type="fig" rid="fig3">Figure 3</xref> shows the process by which the resolution is enhanced from the low resolution shown in <xref ref-type="fig" rid="fig3">Figure 3</xref>(c) where Equation (4) was applied for template matching T(b) in <xref ref-type="fig" rid="fig7">Figure 7</xref>(b).</p><p>To compute the computational cost for coarse-to-fine method assume that the size of the source image is<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x56.png" xlink:type="simple"/></inline-formula>. For each level of the resolution process, calculation of the sum of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x56.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x57.png" xlink:type="simple"/></inline-formula> neighboring pixels requires <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x56.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x57.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x58.png" xlink:type="simple"/></inline-formula> additions (see Equation (4)). However, using the idea for fast calculation of the sum developed</p><p>in [<xref ref-type="bibr" rid="scirp.55307-ref20">20</xref>] , the complexity can be reduced to be <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x59.png" xlink:type="simple"/></inline-formula> additions for each level. If the block size is <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x59.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x60.png" xlink:type="simple"/></inline-formula> the overhead for construction the resolution process is<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x59.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x60.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x61.png" xlink:type="simple"/></inline-formula>. Since there are <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x59.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x60.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x61.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x62.png" xlink:type="simple"/></inline-formula></p><p>template blocks in the source image, the computation overhead for each template block is</p><p><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x63.png" xlink:type="simple"/></inline-formula>which is<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x63.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x64.png" xlink:type="simple"/></inline-formula>. This shows that the complexity of coarse-to-fine method is better than NCC and SAD techniques.</p></sec></sec><sec id="s3"><title>3. The Proposed One-Dimensional Algorithm (M1D)</title><p>Fouda [<xref ref-type="bibr" rid="scirp.55307-ref14">14</xref>] proposed a template matching technique depending on converting the image data from 2-D into 1-D. His method is efficient for the time but it is sensitive to the noise. The proposed M1D method is a modification for 1-D method to avoid its sensitive to noise. In our method, we try to make the template matching is more robust to noise. This can be done by adding a new features to information vector to be of size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x65.png" xlink:type="simple"/></inline-formula> instead of<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x65.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x66.png" xlink:type="simple"/></inline-formula>. First, the amount of data analyzed reduce by transforming the template image and all blocks in the</p><fig-group id="fig3"><label><xref ref-type="fig" rid="fig3">Figure 3</xref></label><caption><title> Three resolution levels for template T(b) in <xref ref-type="fig" rid="fig7">Figure 7</xref> by coarse-to-fine method using Equation (4). (a) level 0; (b) level 1; (c) level 2.</title></caption><fig id ="fig3_1"><label> (b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x67.png"/></fig><fig id ="fig3_2"><label> (c)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x68.png"/></fig><fig id ="fig3_3"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x69.png"/></fig></fig-group><p>source image which has the same size of template from two dimensional into one dimensional information vector. The new information vector data consists of two parts. The first part is the summation of all intensity values for each column in the 2-D image (see Equation (5)). The second part is the summation of all intensity values for each row in the 2-D image (see Equation (6)). In this case we scanned the 2-D image in two directions (vertical and horizontal) to make our technique more robust against noise. The new information vector (see Equation (7)) will be used in the matching process instead of 2-D image. Subsequently, this allows the search to be performed with fewer data, while still taking all pixels intensity values into account. Secondly, the sum of squared differences is used to measure the likeness between 1-D template and all possible 1-D blocks in the source image. Another measure can be used such as sum of absolute difference or Euclidean distance between template and all possible blocks in the source. Finally, the decision will be taken based on the likeness values. The block in the source with minimum similarity value will be the best match for template in the source.</p><p>To formalize the problem, suppose that we have a source image S of size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x70.png" xlink:type="simple"/></inline-formula> and template image T of size <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x70.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x71.png" xlink:type="simple"/></inline-formula> where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x70.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x71.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x72.png" xlink:type="simple"/></inline-formula> and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x70.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x71.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x72.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x73.png" xlink:type="simple"/></inline-formula>. The problem is to find the correct match for the template T in the source S.</p><p>First, we scan the template image in the vertical direction by adding up the intensity values of rows for each column. Then the first part <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x74.png" xlink:type="simple"/></inline-formula> in 1-D information vector for the template is constructed and can be given by:</p><disp-formula id="scirp.55307-formula1049"><label>(5)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x75.png"  xlink:type="simple"/></disp-formula><p>Next, we scan the template image in the horizontal direction by adding up the intensity values of columns for each row. Then the second part <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x76.png" xlink:type="simple"/></inline-formula> for the template in the 1-D template information vector is constructed and given by the following formula:</p><disp-formula id="scirp.55307-formula1050"><label>(6)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x77.png"  xlink:type="simple"/></disp-formula><p>Now, the template image <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x78.png" xlink:type="simple"/></inline-formula> converted to 1-D template information vector <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x78.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x79.png" xlink:type="simple"/></inline-formula> of length <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x78.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x79.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x80.png" xlink:type="simple"/></inline-formula> which can be formulated by the following equation:</p><disp-formula id="scirp.55307-formula1051"><label>(7)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x81.png"  xlink:type="simple"/></disp-formula><p>where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x82.png" xlink:type="simple"/></inline-formula> is the pixel value at location <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x82.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x83.png" xlink:type="simple"/></inline-formula> of the template image.</p><p>Secondly, for each pixel <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x84.png" xlink:type="simple"/></inline-formula> in the source image S, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x84.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x85.png" xlink:type="simple"/></inline-formula>and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x84.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x85.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x86.png" xlink:type="simple"/></inline-formula>, we determine a block <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x84.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x85.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x86.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x87.png" xlink:type="simple"/></inline-formula> of size<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x84.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x85.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x86.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x87.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x88.png" xlink:type="simple"/></inline-formula>. All these blocks are scanned in a similar way as in the template image to obtain NB<sub>1</sub> and NB<sub>2</sub> by the following formulas:</p><disp-formula id="scirp.55307-formula1052"><label>(8)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x89.png"  xlink:type="simple"/></disp-formula><p>and</p><disp-formula id="scirp.55307-formula1053"><label>(9)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x90.png"  xlink:type="simple"/></disp-formula><p>Then a 1-D information vector is constructed also as in the template image by the following formula:</p><disp-formula id="scirp.55307-formula1054"><graphic  xlink:href="http://html.scirp.org/file/7-3400389x91.png"  xlink:type="simple"/></disp-formula><p>(10)</p><p>where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x92.png" xlink:type="simple"/></inline-formula> is the pixel value at location <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x92.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x93.png" xlink:type="simple"/></inline-formula> of the source image.</p><p>Thirdly, the likeness between template image and each corresponding block in the source are measured by sum of square difference distance between NT and NB. All these distances compute and store in new storage <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x94.png" xlink:type="simple"/></inline-formula> where</p><disp-formula id="scirp.55307-formula1055"><label>(11)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x95.png"  xlink:type="simple"/></disp-formula><p>The position <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x96.png" xlink:type="simple"/></inline-formula> at which the smallest value of <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x96.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x97.png" xlink:type="simple"/></inline-formula> is obtained corresponds the left upper corner of the best match for the template in our proposed method.</p><p>Now we discuss the computational cost considered in our proposed method. First the cost of converting the template and all blocks in the source into 1-D can be ignored in our proposed method, since for the template this need only be done once, and when we are calculating the computational cost for every position of the blocks in the source, the contribution due to summing the blocks become negligible compared with computing matrix <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x98.png" xlink:type="simple"/></inline-formula> in Equation (11). The main complexity of our proposed method depends on the computations found in the matrix <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x98.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x99.png" xlink:type="simple"/></inline-formula> in Equation (11). This equation can be written as:</p><disp-formula id="scirp.55307-formula1056"><label>(12)</label><graphic position="anchor" xlink:href="http://html.scirp.org/file/7-3400389x100.png"  xlink:type="simple"/></disp-formula><p>for some function <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x101.png" xlink:type="simple"/></inline-formula> where <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x101.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x102.png" xlink:type="simple"/></inline-formula> by expanding <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x101.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x102.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x103.png" xlink:type="simple"/></inline-formula> into <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x101.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x102.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x103.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x104.png" xlink:type="simple"/></inline-formula> of the definition</p><p>of matrix<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x105.png" xlink:type="simple"/></inline-formula>: The matrices corresponding to the <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x105.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x106.png" xlink:type="simple"/></inline-formula> term and (respectively) <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x105.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x106.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x107.png" xlink:type="simple"/></inline-formula>term are easy to compute in</p><p><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x108.png" xlink:type="simple"/></inline-formula>time as in [<xref ref-type="bibr" rid="scirp.55307-ref21">21</xref>] . The matrix corresponding to the xy term can be computed in <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x108.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x109.png" xlink:type="simple"/></inline-formula> as in [<xref ref-type="bibr" rid="scirp.55307-ref22">22</xref>] . Then for every value in the matrix <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x108.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x109.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x110.png" xlink:type="simple"/></inline-formula> the complexity for xy term is<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x108.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x109.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x110.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x111.png" xlink:type="simple"/></inline-formula>. Finally, if we</p><p>take the maximum complexity for the three terms<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x112.png" xlink:type="simple"/></inline-formula>, <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x112.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x113.png" xlink:type="simple"/></inline-formula>, and<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x112.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x113.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x114.png" xlink:type="simple"/></inline-formula>, the complexity of our proposed method</p><p>not exceed <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x115.png" xlink:type="simple"/></inline-formula> which is more efficient than coarse-to-fine method.</p></sec><sec id="s4"><title>4. Experimental Results</title><p>In this section, we show the efficiency improvement of the proposed algorithm for one dimensional based template matching. In order to make the template matching more robust the proposed method added a new feature for the vectors made in one dimensional algorithm. To compare the efficiency of the proposed algorithm, we also implement the normalized cross correlation (NCC), sum of absolute difference (SAD), coarse to fine (CTF), and one dimensional (1-D) methods. Theses algorithms were implemented in a Matlab 7.0 on a Laptop with an Intel&#174; Core™2 Duo CPU T7500 @ 2.20 GHz and 1.99 GB RAM. Two types of images are used for the testing purpose RGB images and gray scale images. Greens image of size 300 &#215; 500 and its noisy version as the source image is a representative for RGB case (see <xref ref-type="fig" rid="fig4">Figure 4</xref>(a) and <xref ref-type="fig" rid="fig4">Figure 4</xref>(b)). Six template images of size 100 &#215; 100 selected from the original greens image as shown in <xref ref-type="fig" rid="fig5">Figure 5</xref>. The templates in Figures 5(d)-(f) are the brighter version (increase brightness from 22% to 30%) of the original templates in Figures 5(a)-(c), respectively. Two-man image of size 240 &#215; 300 and its noisy version as the source is a representative for gray scale case (see <xref ref-type="fig" rid="fig6">Figure 6</xref>(a) and <xref ref-type="fig" rid="fig6">Figure 6</xref>(b)). Six template images of size 50 &#215; 50 selected from the original two-man image as shown in <xref ref-type="fig" rid="fig7">Figure 7</xref>. The templates in Figures 7(d)-(f) are the brighter version (increase brightness from 21% to 24%) of the original templates in Figures 7(a)-(c), respectively.</p><fig-group id="fig4"><label><xref ref-type="fig" rid="fig4">Figure 4</xref></label><caption><title> RGB image case (a) source greens image and (b) the noisy greens image added with Gaussian noise with variance 0.01.</title></caption><fig id ="fig4_1"><label>(b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x116.png"/></fig><fig id ="fig4_2"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x117.png"/></fig></fig-group><fig-group id="fig5"><label><xref ref-type="fig" rid="fig5">Figure 5</xref></label><caption><title> Six template from green image (a)-(c) three template sample of size 100 &#215; 100, (d) bright version of (a) by 22%, (e) bright version of (b) by 30%, and (f) bright version of (d) by 24%.</title></caption><fig id ="fig5_1"><label> (b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x118.png"/></fig><fig id ="fig5_2"><label> (c)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x119.png"/></fig><fig id ="fig5_3"><label>(d)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x120.png"/></fig><fig id ="fig5_4"><label> (e)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x121.png"/></fig><fig id ="fig5_5"><label> (f)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x122.png"/></fig><fig id ="fig5_6"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x123.png"/></fig></fig-group><fig-group id="fig6"><label><xref ref-type="fig" rid="fig6">Figure 6</xref></label><caption><title> Gray scale image case (a) Source two-man image and (b) the noisy two-man image added with Gaussian noise with variance 0.01.</title></caption><fig id ="fig6_1"><label> (b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x124.png"/></fig><fig id ="fig6_2"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x125.png"/></fig></fig-group><fig-group id="fig7"><label><xref ref-type="fig" rid="fig7">Figure 7</xref></label><caption><title> Six templates from two-man image (a)-(c) three template sample of size 50 &#215; 50, (d) bright version of (a) by 24%, (e) bright version of (b) by 21%, and (f) bright version of (d) by 23%.</title></caption><fig id ="fig7_1"><label> (b)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x126.png"/></fig><fig id ="fig7_2"><label> (c)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x127.png"/></fig><fig id ="fig7_3"><label>(d)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x128.png"/></fig><fig id ="fig7_4"><label> (e)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x129.png"/></fig><fig id ="fig7_5"><label> (f)</label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x130.png"/></fig><fig id ="fig7_6"><label></label><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x131.png"/></fig></fig-group><p>Let us start by the RGB case through the greens image <xref ref-type="fig" rid="fig4">Figure 4</xref>(a) and its templates in <xref ref-type="fig" rid="fig5">Figure 5</xref>. To compare the robustness and the efficiency of the proposed algorithm, we add random Gaussian noises with mean 0 and variance 0.01 onto the source image as shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>(b) and compare the performance of the pattern search on the noisy image. NCC, SAD, CTF, and the proposed M1D algorithm are guaranteed to the find the correct match from the source image, so we only focus on the comparison of search time required for these algorithms. The execution time required for these algorithms applied on the greens image in the clear case and noisy version are shown in <xref ref-type="table" rid="table1">Table 1</xref> and <xref ref-type="table" rid="table2">Table 2</xref>, respectively.</p><p>The results in <xref ref-type="table" rid="table1">Table 1</xref> and <xref ref-type="table" rid="table2">Table 2</xref> are several experiments were carried out with three different templates T(a), T(b), and T(c) and its brightness version in <xref ref-type="fig" rid="fig5">Figure 5</xref>. The true position for these templates in the source image are (200, 175), (50, 15), and (15, 150) respectively. When the brightness are increased for the three templates (T(d), T(e), an T(f) in <xref ref-type="table" rid="table1">Table 1</xref>) or the noises are added to the source (<xref ref-type="table" rid="table2">Table 2</xref>), All the algorithms are given the same position except 1-D algorithm given (200, 164), (50, 19), and (15, 160) respectively, which are a false positions (indicated by * in <xref ref-type="table" rid="table1">Table 1</xref> and <xref ref-type="table" rid="table2">Table 2</xref>). This ensures the fact that 1-D algorithm is sensitive to noise because it depends on a little numbers of features. But 1-D algorithm gives the best running time as in <xref ref-type="table" rid="table1">Table 1</xref> and <xref ref-type="table" rid="table2">Table 2</xref> when the source and template are free from noise. On the other hand the proposed M1D algorithm gives a correct match when the noise are added to the template and/or source and in the same time, the running time is better than NCC, SAD, and CTF algorithms. <xref ref-type="fig" rid="fig8">Figure 8</xref> and <xref ref-type="fig" rid="fig9">Figure 9</xref> shows the performance of the proposed algorithm compared with other algorithms except 1-D algorithm which fail to find the correct match under noise conditions. It is clear that the proposed algorithm outperform the others in the two cases where the noise are added for template and/or added to the source.</p><p>Secondly the proposed algorithm was tested under the gray scale case through the two-man image <xref ref-type="fig" rid="fig6">Figure 6</xref>(a) and its templates in <xref ref-type="fig" rid="fig7">Figure 7</xref>. As in the RGB case the random Gaussian noise was added with mean 0 and variance 0.01 onto the two-man source image as shown in <xref ref-type="fig" rid="fig6">Figure 6</xref>(b). <xref ref-type="table" rid="table3">Table 3</xref> and <xref ref-type="table" rid="table4">Table 4</xref> show the experimental results of applying different templates of size 50 &#215; 50 as shown in <xref ref-type="fig" rid="fig7">Figure 7</xref>. The templates in Figures 7(d)-(f) are the brighter versions of the original templates in Figures 7(a)-(c), respectively. All of these experimental results show the significantly improved efficiency of the proposed algorithm for the one dimensional based pattern matching compared to NCC, SAD, and CTF. For example in the clear case from <xref ref-type="table" rid="table1">Table 1</xref>, if we take the template T(d) we see that the improvement of SAD, CTF, 1-D, and MID are 64.47%, 72.58%, 95.65%, and 92.21% respectively. Then the 1-D is the best running time but he give a false match (indicated by *) for the templates</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> Execution time by seconds of applying NCC, SAD, CTF, 1-D and the proposed M1D algorithm with the six templates shown in Figures 5(a)-(f) and the source image shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>(a)</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Seconds</th><th align="center" valign="middle" >T(a)</th><th align="center" valign="middle" >T(b)</th><th align="center" valign="middle" >T(c)</th><th align="center" valign="middle" >T(d)</th><th align="center" valign="middle" >T(e)</th><th align="center" valign="middle" >T(f)</th></tr></thead><tr><td align="center" valign="middle" >NCC</td><td align="center" valign="middle" >70.25</td><td align="center" valign="middle" >71.03</td><td align="center" valign="middle" >69.98</td><td align="center" valign="middle" >69.73</td><td align="center" valign="middle" >69.76</td><td align="center" valign="middle" >74.03</td></tr><tr><td align="center" valign="middle" >SAD</td><td align="center" valign="middle" >45.61</td><td align="center" valign="middle" >46.06</td><td align="center" valign="middle" >45.92</td><td align="center" valign="middle" >45.65</td><td align="center" valign="middle" >45.98</td><td align="center" valign="middle" >45.7</td></tr><tr><td align="center" valign="middle" >CTF</td><td align="center" valign="middle" >23.59</td><td align="center" valign="middle" >49.53</td><td align="center" valign="middle" >34.33</td><td align="center" valign="middle" >23.59</td><td align="center" valign="middle" >49.89</td><td align="center" valign="middle" >33.91</td></tr><tr><td align="center" valign="middle" >1-D</td><td align="center" valign="middle" >8.17</td><td align="center" valign="middle" >6.41</td><td align="center" valign="middle" >8.66</td><td align="center" valign="middle" >6.65<sup>* </sup></td><td align="center" valign="middle" >8.28<sup>* </sup></td><td align="center" valign="middle" >6.61<sup>* </sup></td></tr><tr><td align="center" valign="middle" >M1D</td><td align="center" valign="middle" >12.36</td><td align="center" valign="middle" >11.86</td><td align="center" valign="middle" >11.72</td><td align="center" valign="middle" >12.33</td><td align="center" valign="middle" >10.22</td><td align="center" valign="middle" >11.56</td></tr></tbody></table></table-wrap><table-wrap id="table2" ><label><xref ref-type="table" rid="table2">Table 2</xref></label><caption><title> Execution time by seconds of applying NCC, SAD, CTF, 1-D and the proposed M1D algorithm with the six templates shown in Figures 5(a)-(f) and the noise source image shown in <xref ref-type="fig" rid="fig4">Figure 4</xref>(b)</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Seconds</th><th align="center" valign="middle" >T(a)</th><th align="center" valign="middle" >T(b)</th><th align="center" valign="middle" >T(c)</th><th align="center" valign="middle" >T(d)</th><th align="center" valign="middle" >T(e)</th><th align="center" valign="middle" >T(f)</th></tr></thead><tr><td align="center" valign="middle" >NCC</td><td align="center" valign="middle" >75.49</td><td align="center" valign="middle" >74.84</td><td align="center" valign="middle" >79.67</td><td align="center" valign="middle" >74.86</td><td align="center" valign="middle" >79.73</td><td align="center" valign="middle" >78.08</td></tr><tr><td align="center" valign="middle" >SAD</td><td align="center" valign="middle" >47.42</td><td align="center" valign="middle" >48.37</td><td align="center" valign="middle" >47.56</td><td align="center" valign="middle" >45.73</td><td align="center" valign="middle" >45.93</td><td align="center" valign="middle" >45.78</td></tr><tr><td align="center" valign="middle" >CTF</td><td align="center" valign="middle" >23.75</td><td align="center" valign="middle" >51.15</td><td align="center" valign="middle" >35.36</td><td align="center" valign="middle" >23.64</td><td align="center" valign="middle" >51.31</td><td align="center" valign="middle" >33.94</td></tr><tr><td align="center" valign="middle" >1-D</td><td align="center" valign="middle" >7.98</td><td align="center" valign="middle" >8.05</td><td align="center" valign="middle" >8.56</td><td align="center" valign="middle" >8.22<sup>* </sup></td><td align="center" valign="middle" >6.59<sup>* </sup></td><td align="center" valign="middle" >6.61<sup>* </sup></td></tr><tr><td align="center" valign="middle" >M1D</td><td align="center" valign="middle" >10.25</td><td align="center" valign="middle" >12.78</td><td align="center" valign="middle" >12.87</td><td align="center" valign="middle" >12.55</td><td align="center" valign="middle" >11.87</td><td align="center" valign="middle" >12.76</td></tr></tbody></table></table-wrap><fig id="fig8"  position="float"><label><xref ref-type="fig" rid="fig8">Figure 8</xref></label><caption><title> Performance of the proposed algorithm under clear greens image</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x132.png"/></fig><fig id="fig9"  position="float"><label><xref ref-type="fig" rid="fig9">Figure 9</xref></label><caption><title> Performance of the proposed algorithm using greens image with noise</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x133.png"/></fig><table-wrap id="table3" ><label><xref ref-type="table" rid="table3">Table 3</xref></label><caption><title> Execution time by seconds of applying NCC, SAD, CTF, 1-D and the proposed M1D algorithm with the six templates shown in Figures 7(a)-(f) and the source image shown in <xref ref-type="fig" rid="fig6">Figure 6</xref>(a)</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Seconds</th><th align="center" valign="middle" >T(a)</th><th align="center" valign="middle" >T(b)</th><th align="center" valign="middle" >T(c)</th><th align="center" valign="middle" >T(d)</th><th align="center" valign="middle" >T(e)</th><th align="center" valign="middle" >T(f)</th></tr></thead><tr><td align="center" valign="middle" >NCC</td><td align="center" valign="middle" >21.47</td><td align="center" valign="middle" >21.59</td><td align="center" valign="middle" >23.33</td><td align="center" valign="middle" >20.42</td><td align="center" valign="middle" >21.88</td><td align="center" valign="middle" >24.47</td></tr><tr><td align="center" valign="middle" >SAD</td><td align="center" valign="middle" >7.18</td><td align="center" valign="middle" >7.28</td><td align="center" valign="middle" >7.31</td><td align="center" valign="middle" >7.2</td><td align="center" valign="middle" >7.2</td><td align="center" valign="middle" >7.19</td></tr><tr><td align="center" valign="middle" >CTF</td><td align="center" valign="middle" >6.14</td><td align="center" valign="middle" >5.17</td><td align="center" valign="middle" >3.99</td><td align="center" valign="middle" >5.6</td><td align="center" valign="middle" >5.06</td><td align="center" valign="middle" >3.95</td></tr><tr><td align="center" valign="middle" >1-D</td><td align="center" valign="middle" >0.87</td><td align="center" valign="middle" >0.87</td><td align="center" valign="middle" >0.89</td><td align="center" valign="middle" >0.89<sup>* </sup></td><td align="center" valign="middle" >0.91<sup>* </sup></td><td align="center" valign="middle" >0.89<sup>* </sup></td></tr><tr><td align="center" valign="middle" >M1D</td><td align="center" valign="middle" >1.64</td><td align="center" valign="middle" >1.66</td><td align="center" valign="middle" >1.61</td><td align="center" valign="middle" >1.59</td><td align="center" valign="middle" >1.62</td><td align="center" valign="middle" >1.61</td></tr></tbody></table></table-wrap><table-wrap id="table4" ><label><xref ref-type="table" rid="table4">Table 4</xref></label><caption><title> Execution time by seconds of applying NCC, SAD, CTF, 1-D and the proposed M1D algorithm with the six templates shown in Figures 7(a)-(f) and the noise source image shown in <xref ref-type="fig" rid="fig6">Figure 6</xref>(b)</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Seconds</th><th align="center" valign="middle" >T(a)</th><th align="center" valign="middle" >T(b)</th><th align="center" valign="middle" >T(c)</th><th align="center" valign="middle" >T(d)</th><th align="center" valign="middle" >T(e)</th><th align="center" valign="middle" >T(f)</th></tr></thead><tr><td align="center" valign="middle" >NCC</td><td align="center" valign="middle" >23.11</td><td align="center" valign="middle" >23.64</td><td align="center" valign="middle" >22.76</td><td align="center" valign="middle" >23.47</td><td align="center" valign="middle" >22.53</td><td align="center" valign="middle" >24.76</td></tr><tr><td align="center" valign="middle" >SAD</td><td align="center" valign="middle" >7.5</td><td align="center" valign="middle" >7.2</td><td align="center" valign="middle" >7.15</td><td align="center" valign="middle" >7.44</td><td align="center" valign="middle" >7.42</td><td align="center" valign="middle" >7.23</td></tr><tr><td align="center" valign="middle" >CTF</td><td align="center" valign="middle" >5.76</td><td align="center" valign="middle" >5.11</td><td align="center" valign="middle" >3.92</td><td align="center" valign="middle" >5.54</td><td align="center" valign="middle" >4.98</td><td align="center" valign="middle" >4.06</td></tr><tr><td align="center" valign="middle" >1-D</td><td align="center" valign="middle" >0.89</td><td align="center" valign="middle" >0.91</td><td align="center" valign="middle" >0.92</td><td align="center" valign="middle" >0.92<sup>* </sup></td><td align="center" valign="middle" >0.92<sup>* </sup></td><td align="center" valign="middle" >0.88<sup>* </sup></td></tr><tr><td align="center" valign="middle" >M1D</td><td align="center" valign="middle" >1.58</td><td align="center" valign="middle" >1.56</td><td align="center" valign="middle" >1.56</td><td align="center" valign="middle" >1.59</td><td align="center" valign="middle" >1.59</td><td align="center" valign="middle" >1.58</td></tr></tbody></table></table-wrap><p>T(d), T(e), and T(f). The proposed algorithm M1D give improvement 92.21% and give a correct match under the noise conditions. In addition, the proposed algorithm gives a correct match under illumination changes it outperforms the other algorithms in the running time.</p><p>The execution time in <xref ref-type="table" rid="table3">Table 3</xref> and <xref ref-type="table" rid="table4">Table 4</xref> is less than execution time of <xref ref-type="table" rid="table1">Table 1</xref> and <xref ref-type="table" rid="table2">Table 2</xref> because the sizes of two-man image and its templates less than the size of green image and its templates. From <xref ref-type="table" rid="table3">Table 3</xref> we notice that 1-D algorithm is the best and it is give a correct result when the source and templates (T(a), T(b), and T(C)) are clean. But when the brightness are added to templates T(d), T(e), and T(f) the 1-D algorithm is fail to find a correct match. In this context, the proposed algorithm M1D give a correct match for brightness templates and also it gives the best results compared with other algorithms. From <xref ref-type="table" rid="table4">Table 4</xref> when the noises are added to the source all algorithms given a correct match except the 1-D algorithm is fail when the brightness are added to the templates, but it gives the best result when templates are clean. Finally, we can say that, if the source and templates are clean 1-D gives a correct match and best running time. But if there is a noise in the source or in the templates the proposed algorithm gives a correct match and best results compared with other algorithms. <xref ref-type="fig" rid="fig1">Figure 1</xref>0 and <xref ref-type="fig" rid="fig1">Figure 1</xref>1 show the performance of the proposed algorithm compared with other algorithms except 1-D algorithm which fail to find the correct match under noise conditions. It can be found that our method is about 14 times faster than NCC method, about five times faster than SAD method, and about three and half times faster than CTF method in the total computation time. That the model one-dimensional information vector, due to the transformation process, allow estimation by simple sum calculation rather than a complex calculation. Therefore, the matching time of proposed algorithm is reduced.</p><fig id="fig10"  position="float"><label><xref ref-type="fig" rid="fig1">Figure 1</xref>0</label><caption><title> Performance of the proposed algorithm (MID) under clear two-man image</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x134.png"/></fig><fig id="fig11"  position="float"><label><xref ref-type="fig" rid="fig1">Figure 1</xref>1</label><caption><title> Performance of the proposed algorithm (M1D) using two-man image with noise</title></caption><graphic mimetype="image"   position="float"  xlink:type="simple"  xlink:href="http://html.scirp.org/file/7-3400389x135.png"/></fig></sec><sec id="s5"><title>5. Conclusions</title><p>In this paper, we proposed a one-dimensional full searching algorithm for template matching. It depends on reducing image data form <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x136.png" xlink:type="simple"/></inline-formula> to<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x136.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x137.png" xlink:type="simple"/></inline-formula>. So it performs better than three basic two-dimensional algorithms in template matching (NCC, SAD, and CTF). The proposed algorithm scans the template and blocks in the source image in vertical and horizontal directions. Therefore, it is robust against noise when the changes of illuminations are occurred in the template image. Also experiments demonstrate that the proposed algorithm is robust to detect the object when the Gaussian noises are added to the source image.</p><p>It has been shown theoretically and experimentally that the computational cost of the proposed algorithm is<inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x138.png" xlink:type="simple"/></inline-formula>, where the size of the source image is <inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x138.png" xlink:type="simple"/></inline-formula><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x139.png" xlink:type="simple"/></inline-formula> and the size of the template image is</p><p><inline-formula><inline-graphic xlink:href="http://html.scirp.org/file/7-3400389x140.png" xlink:type="simple"/></inline-formula>. The proposed algorithm resolves of the shortcomings of the image-based approach where the computational cost is huge, and expands the usefulness of template matching. To make the template matching more robust, future developments will take into consideration the correlation coefficient among sum vectors instead of the sum of square differences.</p></sec></body><back><ref-list><title>References</title><ref id="scirp.55307-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Du-Ming, T. and Chien-Ta, L. (2003) Fast Normalized cross Correlation for Detect Detection. Pattern Recognition Letters, 24, 2625-2613. http://dx.doi.org/10.1016/S0167-8655(03)00106-5</mixed-citation></ref><ref id="scirp.55307-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Costa, C.E. and Petrou, M. (2000) Automatic Registration of Ceramic Tiles for the Prop Use of Fault Detection. Machine Vision and Applications, 11, 225-230. http://dx.doi.org/10.1007/s001380050105</mixed-citation></ref><ref id="scirp.55307-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Li, R., Zeng, B. and Liou, M.L. (1994) A New Three-Step Search Algorithm for Block Motion Estimation. IEEE Transactions on Circuits and Systems for Video Technology, 4, 438-442. http://dx.doi.org/10.1109/76.313138</mixed-citation></ref><ref id="scirp.55307-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Chen, Y., Hung, Y. and Fuh, C. (2001) Fast Block Matching Algorithm Based on the Winner-Update Strategy. IEEE Transactions on Image Processing, 10, 1212-1222. http://dx.doi.org/10.1109/83.935037</mixed-citation></ref><ref id="scirp.55307-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Koga, T., Inuma, K., Hirano, A., Iijima, Y. and Ishiguro, T. (1981) Motion Compensated Interframe Coding for Video Conferencing. Proc. Nat. Telecommunications Conf., 4, G5.3.1-G5.3.5.</mixed-citation></ref><ref id="scirp.55307-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Jain, J.R. and Jain, A.K. (1981) Displacement Measurement and Its Application in Interframe Image Coding. IEEE Transactions on Communications, 29, 1799-1808. http://dx.doi.org/10.1109/TCOM.1981.1094950</mixed-citation></ref><ref id="scirp.55307-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Ghanbari, M. (1990) The Cross-Search Algorithm for Motion Estimation [Image Coding]. IEEE Transactions on Communications, 38, 950-953. http://dx.doi.org/10.1109/26.57512</mixed-citation></ref><ref id="scirp.55307-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Liu, B. and Zaccarin, A. (1993) New Fast Algorithms for the Estimation of Block Motion Vectors. IEEE Transactions on Circuits and Systems for Video Technology, 3, 148-157. http://dx.doi.org/10.1109/76.212720</mixed-citation></ref><ref id="scirp.55307-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Bei, C.D. and Gray, R.M. (1985) An Improvement for the Minimum Distortion Encoding Algorithm for Vector Quantization. IEEE Transactions on Communications, 33, 1132-1133.</mixed-citation></ref><ref id="scirp.55307-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Gersho, A. and Gray, R.M. (1992) Vector Quantization and Signal Compression. Kluwer, Norwell.</mixed-citation></ref><ref id="scirp.55307-ref11"><label>11</label><mixed-citation publication-type="other" xlink:type="simple">Shi, Y.Q. and Xia, X. (1997) A Thresholding Multiresolution Block Matching Algorithm. IEEE Transactions on Circuits and Systems for Video Technology, 7, 437-440. http://dx.doi.org/10.1109/76.564124</mixed-citation></ref><ref id="scirp.55307-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Nam, K.M., Kim, J.S., Park, R.H. and Shim, Y.S. (1995) A Fast Hierarchical Motion Vector Estimation Algorithm Using Mean Pyramid. IEEE Transactions on Circuits and Systems for Video Technology, 5, 344-351. http://dx.doi.org/10.1109/76.465087</mixed-citation></ref><ref id="scirp.55307-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Lin, Y.-H. and Chen, C.-H. (2008) Template Matching Using the Parametric Template Vector with Translation, Rotation, and Scale Invariance. Pattern Recognition, 41, 2413-2421. http://dx.doi.org/10.1016/j.patcog.2008.01.017</mixed-citation></ref><ref id="scirp.55307-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Fouda, Y.M. (2014) One-Dimensional Vector Based Template Matching. International Journal of Computer Science and Information Technology, 6, 47-58. http://dx.doi.org/10.5121/ijcsit.2014.6404</mixed-citation></ref><ref id="scirp.55307-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Tsai, D. and Lin, C. (2003) Fast Normalized cross Correlation for Defect Detection. Pattern Recognition Letters, 24, 2625-2631. http://dx.doi.org/10.1016/S0167-8655(03)00106-5</mixed-citation></ref><ref id="scirp.55307-ref16"><label>16</label><mixed-citation publication-type="other" xlink:type="simple">Sebe, N., Lew, M.S. and Huijsmans, D.P. (2000) Toward Improved Ranking Metrics. IEEE Transactions on Pattern Analysis and Machine Intelligence, 22, 1132-1143. http://dx.doi.org/10.1109/34.879793</mixed-citation></ref><ref id="scirp.55307-ref17"><label>17</label><mixed-citation publication-type="other" xlink:type="simple">Mahmood, A. and Khan, S. (2012) Correlation Coefficient Based Fast Template Matching through Partial Elimination. IEEE Transactions on Image Processing, 21, 2099-2108. http://dx.doi.org/10.1109/TIP.2011.2171696</mixed-citation></ref><ref id="scirp.55307-ref18"><label>18</label><mixed-citation publication-type="other" xlink:type="simple">Rosenfeld, A. and Vanderbrug, G.J. (1977) Coarse-Fine Template Matching. IEEE Transactions on Systems, Man and Cybernetics, 7, 104-107.</mixed-citation></ref><ref id="scirp.55307-ref19"><label>19</label><mixed-citation publication-type="other" xlink:type="simple">Vanderbrug, G.J. and Rosenfeld, A. (1977) Two-stage Template Matching. IEEE Transactions on Computers, C-26, 384-393. http://dx.doi.org/10.1109/TC.1977.1674847</mixed-citation></ref><ref id="scirp.55307-ref20"><label>20</label><mixed-citation publication-type="other" xlink:type="simple">Lee, C. and Chen, L. (1997) A Fast Motion Estimation Algorithm Based on the Block Sum Pyramid. IEEE Transactions on Image Processing, 6, 1587-1591. http://dx.doi.org/10.1109/83.641419</mixed-citation></ref><ref id="scirp.55307-ref21"><label>21</label><mixed-citation publication-type="other" xlink:type="simple">Gonzalez, R.C. and Woods, R.E. (1992) Digital Image Processing. Addison-Wesley, Reading.</mixed-citation></ref><ref id="scirp.55307-ref22"><label>22</label><mixed-citation publication-type="other" xlink:type="simple">Atallah, M.J. (2001) Faster Image Template Matching in the Sum of the Absolute Value of Differences Measure. IEEE Transactions on Image Processing, 10, 659-663. http://dx.doi.org/10.1109/83.913600</mixed-citation></ref></ref-list></back></article>