SlideShare a Scribd company logo
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
ONE-DIMENSIONAL VECTOR BASED PATTERN 
MATCHING 
Y. M. Foudaa,b 
a College of Computer Science and Information Technology, King Faisal University, P.O. 
Box 400, Al-Ahsa 31982, Kingdom of Saudi Arabia. 
b Mathematics Department, Faculty of Science, Mansoura University, Mansoura 35516, 
Egypt. 
ABSTRACT 
Template matching is a basic method in image analysis to extract useful information from images. In this 
paper, we suggest a new method for pattern matching. Our method transform the template image from two 
dimensional image into one dimensional vector. Also all sub-windows (same size of template) in the 
reference image will transform into one dimensional vectors. The three similarity measures SAD, SSD, and 
Euclidean are used to compute the likeness between template and all sub-windows in the reference image 
to find the best match. The experimental results show the superior performance of the proposed method 
over the conventional methods on various template of different sizes. 
KEY WORDS 
Image analysis, pattern matching, likeness functions, vector sum. 
1. INTRODUCTION 
Pattern matching is an important technique in pattern recognition and image processing. It is used 
in many applications related to signal processing and machine vision such as object tracking, 
stereo matching, video compression, image retrieval and image registration. Template matching 
tries to answer one of the most basic questions about image: Is there a certain object in that 
image? If so, where? The template is a description of that object, and is used to search the image 
by computing a difference measure between the template and all possible portions of the image 
that could match the template: if any of these produces a small difference, then it is viewed as 
possible occurrence of the object[1]. 
Various difference measures have different mathematical properties, and different computational 
properties had been used to find the best match. 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 of 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 measure 
are sensitive to outliers and is not robust to variations in the template, such as those that occur at 
occluding boundaries in the image. However, the NCC measure is more accurate but it is 
computationally slow. It is more robust than SAD and SSD under uniform illumination changes, 
DOI:10.5121/ijcsit.2014.6404 47
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
so the NCC measure has been widely used in object recognition and industrial inspection such as 
in [2] and [3]. 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 [4]. 
Many improvements were occurred on SAD and NCC algorithms to get a better complexity. 
Mahmood and Khan [5] proposed a partial computation elimination technique in which at a 
particular search location, computations are prematurely terminated as soon as it is found that this 
location cannot compete already known best-match location. They showed that partial 
elimination technique may be applied to correlation coefficient by using a monotonic formulation 
and proposed a basic mode for small template size and an extended mode for medium and larger 
template. Chen et al. [6] proposed a fast block matching algorithm based on the winner-update 
strategy, which can significantly reduce the computation and guarantee to find the globally 
optimal solution. In their algorithm, only the current winner location with a minimal accumulated 
distortion is considered for updating the accumulated distortion. This updating process is repeated 
until the winner has gone through all levels in the pyramids that are constructed from the template 
and all the candidate windows for the distortion calculation. 
Wei and Lai [7] proposed a fast pattern matching algorithm based on NCC criterion by combing 
adaptive multilevel partition with the winner update scheme to achieve very efficient search. This 
winner update scheme is applied in conjunction with an upper bound for the cross correlation 
derived from Cauchy-Schwarz inequality. To apply the winner update scheme in an efficient way, 
they partition the summation of cross correlation into different levels with the partition order 
determined by the gradient energies of the partitioned regions in the template. Thus, this winner 
update scheme in conjunction with the upper bound for NCC can be employed to skip 
unnecessary calculation. Alsaade and Fouda [8] used Cellular Automata with Rule 170 (CA-R170) 
on the images after converting it into binary images. Your technique based on eliminating 
some of the undesirable area in the binary reference images and their corresponding binary 
template images. Essannouni et. al. [9] proposed a frequency algorithm to speed up the process of 
SAD matching using Fast Fourier transforms (FFT). They introduced an approach to approximate 
the SAD metric by cosine series which can be expressed in correlation terms. These latter can be 
computed using FFT algorithms. Alsaade and Fouda [10] proposed a matching algorithm based 
on SAD as a measure of similarity and pyramid structure. They applied the pyramid concept to 
obtain a number of levels of original and template images. Then the SAD measure is applied for 
each level of image from bottom to up to obtain the correct match in the original image. 
In this paper, we propose an efficient pattern search algorithm based on Dimension-Reduction 
approach for images. Dimension-Reduction technique is applied for the template image and all 
corresponding sub-windows in the reference image. In our approach Dimensions-Reduction 
technique based on converting the template and all its corresponding sub-windows in the 
reference from 2-D into 1-D. The sum of square difference measure was used as a similarity 
measure to get the template in the reference. The rest of the paper is organized as follows: the 
proposed algorithm and its complexity analysis is described in section II. Simulation and 
comparison results for NCC and SAD standards are reported in section III. Then we state 
conclusions in section IV. 
48
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
2 . THE MAIN CONTRIBUTION 
In this section we introduce description of the proposed method followed by its complexity 
analysis compared with other four methods. 
2.1 The proposed method 
Our method has been motivated by a need to develop an efficient matching technique so that the 
detection of objects in a reference image can be effective and fast. The proposed matching 
algorithm involves three phases. Phase I reduce the amount of data analyzed by transforming 2-D 
images (template image and sub-windows which has the same size with template in the reference 
image) into 1-D vector information. This can be done by adding all intensity values for each 
column in 2-D image see Eq. (1), so we get 1-D vector information. This vector information will 
be used in the matching process instead of the 2-D image. This transforming reduce the amount 
of image from m × n to n. Subsequently, this allows the search to be performed with fewer data, 
while still taking all pixel intensity values into account. Phase II measure the likeness between 
template image and all possible sub-windows in the reference image. The Euclidean distance or 
sum of absolute difference or sum of square difference can be used as a similarity measure 
between 1-D template and all 1-D converted sub-window in the reference. Phase III the decision 
will be taken based on the similarity values. The sub-window in the reference with minimum 
similarity value will be the best match for template in the reference. 
The basic idea of the proposed template matching depending on converting 2-D template image 
into 1-D and also the corresponding windows in the reference image over which the template lies. 
To illustrate the idea suppose that we have a reference image S of size p×q and template image T 
of size m× n where m < p and n < q. The problem is to find the best match of template T from the 
reference image S with minimum distortion. 
( ) ( ,1), ( ,2), ( ,3),, ( , ) (1) 
NW i j W k j W k j W k j  W k n j (2) 
49 
First the template image T(i,j) converted to 1-D vector NT by the equation 
 
 
     
NT i T i T i T i T i n 
 
m 
i 
m 
i 
m 
i 
m 
    
i 
1 1 1 1 
where T(i,j) is the pixel value at location (i,j) of the template image. 
Secondly, for each pixel (i,j) in the reference image S, 1 ≤ i <p-m and 1 ≤ j <q-n, we determine a 
window W(i,j) of size m×n and all these windows converted into 1-D vector NW by the equation 
 
 
            
 
m i 
 
  
 
  
 
  
 
1 1 1 1 
( , ) ( , ), ( , 1), ( , 2), , ( , 1) 
k i 
m i 
k i 
m i 
k i 
m i 
k i 
where W(k,j) is the pixel value at location (k,j) of the reference image. 
Thirdly, the likeness between template image and each corresponding window in the reference 
are measured by sum of square difference distance between NT and NW. All these distances 
compute and store in new storage C(i,j) where
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
1 2 
        
     
    
C i j W k j T i W k j T i  W k n j T i n 
) , ( ) 1 , ( ) 2 , ( ) 1 , ( ) 1 , ( ) , ( ) , (  
50 
1 
1 2 
1 
1 2 
1 
 
 
 
 
 
 
  
  
  
  
  
m i 
k i 
m 
i 
m i 
k i 
m 
i 
m i 
k i 
m 
i 
where 1 ≤ i < p-m and 1 ≤ j < q-n. (3) 
If the positive ordered pair (i, j) be such that C(i, j) is the lowest obtained distance, then return 
(i, j) as the left upper corner of best template match in our proposed method. Fig. (1) show the 
concept of the proposed method. 
Fig. 1: Illustration of the proposed. The template image is converted into 1-D and also the corresponding 
windows in the reference, SSD is calculated at every possible location in the reference. The (i,j) location of 
matrix C with the minimum value is considered as the location of best match.
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
2.2 Complexity analysis 
In order to evaluate the efficiency of the proposed algorithm, we discuss the complexity of our 
algorithm compared with four important methods of template matching NCC, SAD, NCCP, and 
SADP. For NCC algorithm, the cross correlation coefficient between template image T of size 
n×n pixels and an n×n pixels block in reference image S of size p×q is given by: 
( , ) ( , ) ( , ) (5) 
I k (x, y)  1 I k1 x y  I k1 x  y  I k1 x y   I k1 x  y  (6) 
51 
   
 
( , ) ( , ) ( , ) 
( , ) , 1≤i<(p-n), 1≤j<(q-n) 
1 1 
( , ) ( , ) ( , ) 
  
S i  x j  y  S i j T x y  
T 
    
2 2 
    
    
 
n 
x 
n 
y 
n 
x 
n 
y 
n 
x 
n 
y 
S i x j y S i j T x y T 
i j 
1 1 1 1 
(4) 
where 
( , ) 1 ( , ) 1 ( , ) 
    
 
     
 
 
n 
x 
n 
y 
n 
x 
n 
y 
T x y 
n n 
S i x j y and T 
n n 
S i j 
1 1 1 1 
Direct computation of λ(i,j) require n×n=n2 (addition/ multiplication) operations at each point 
(i,j) in the reference image where 1≤ i<(p-n), 1≤ j<(q-n) . Then the operations in Eq. (4) is 
proportional to n2(p-n+1)(q-n+1). So the computational cost of NCC is Ο(n2(p-n+1)(q-n+1)) 
which is very time consuming. 
For SAD method the sum of absolute difference between the template T of size n×n pixels and 
blocks of sizes n×n pixels in the reference image S is given by: 
n 
  
  
SAD i j  S i  x j  y  
T x y 
x 
n 
y 
1 1 
The computation of SAD(i,j) requires a number of operations proportional to the template area 
(n×n). These operations are computed for each (i,j) in the reference image where 1≤ i<(p-n), 1≤ 
j<(q-n). Then the computational cost for SAD method is Ο(n2(p-n+1)(q-n+1)) the same in NCC 
algorithm but the SAD method is faster than NCC method because the number of operations in 
SAD is less than number of operations in NCC for each position (i,j) in the reference image about 
seventy percentage. 
The two methods NCCP and SADP can achieve the same estimation accuracy as NCC and SAD 
while needing much less computation requirement than theses two methods. When the pyramid is 
applied for NCC and SAD, a sequence of compressed template and reference images are created 
using: 
 (2 ,2 ) (2 1,2 ) (2 ,2 1) (2 1,2 1) 
4 
where Ik(x,y) is the intensity value for the image in the level k. The search is conduct using NCC 
or SAD (Eq. (4) or (5)) with the most compressed template and reference image. The resulting 
pixel location provides a coarse location of the template pattern in the next lower level of the
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
reference image. Therefore, instead of performing a complete search in the next level, one require 
to only search a close neighborhood of the area computed from the previous search. This 
sequence is iterated until the search in the reference image is searched. 
In the pyramid concept the complexity of the algorithm depend on the position of template in the 
reference. If the template coordinates is far from the x-direction and y-direction then applying 
pyramid outperform the original method. But, if the x-coordinate for template in reference is 
close to x-axis and/or y-coordinate for template in reference is close y-axis the original method 
outperform the pyramid concept. 
To overcome the problem in pyramid concept and the computational intensive in NCC and SAD 
we introduced our approach. The computation in Eq.(3) require a number of operations 
proportional to the length n of the converted vector from 2-D into 1-D. These operations are 
computed for each position (i,j) in the reference image where 1≤ i<(p-n), 1≤ j<(q-n). Then the 
computational cost of the proposed method is Ο(n(p-n+1)(q-n+1)) and this justify why the 
proposed method outperform the others. 
3 EXPERIMENTAL RESULTS 
To measure the efficiency the proposed method was implemented. For the comparing purpose, 
we also implemented four different algorithms the full-search NCC algorithm, NCC pyramid 
(NCCP) algorithm, sum of absolute difference (SAD) algorithm, and SAD pyramid (SADP) 
algorithm. Theses algorithms were implemented in a Matlab 7.0 on a Laptop with an Intel® 
Core™2 Duo CPU T7500 @ 2.20 GHz and 1.99 GB RAM. Two types of images are used for the 
testing purpose color images and gray scale images. Greens image of size 300×500 is a 
representative for color case see fig. 2(a). Lifting-body of size 512×512 is a representative for 
gray scale case see Fig. 3(a). In our experiments we cropped the templates from the reference (see 
Fig. 2(b) and Fig. 3(b)) so we know in advance the correct position for template in the reference. 
The size of these templates varying from 25×25 to 200×200 pixels. 
52 
(a)
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
53 
(b) 
Fig. 2. (a) Original greens image and (b) The cropped template images form the original with sizes varying 
from 25x25 to 150x200 pixels. 
(a)
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
         
     
C i j W k j T i W k j T i  W k n j T i n 
) , ( ) 1 , ( ) 2 , ( ) 1 , ( ) 1 , ( ) , ( ) , (  
C i j W k j T i W k j T i  W k n j T i n 
( , ) ( , ) ( ,1) ( , 1) ( ,2) ( , 1) ( , ) 
54 
(b) 
Fig. 3. (a) Original Lifting-body image and (b) The cropped template images form the original with sizes 
varying from 25x25 to 200x200 pixels. 
In the clean data, the proposed and compared algorithms are guaranteed to find the correct match 
from the reference image, so we only focus on the comparison of search time required for these 
algorithms. In the proposed method the similarity between template and sub-windows in the 
reference image can be measure using more than one similarity function. For example the 
Euclidean distance or sum of absolute difference or sum of square difference can be used. The 
mathematical formula for sum of square difference are used in our method (see Eq. (3)). To apply 
the Euclidean distance and sum of absolute difference functions in our method their mathematical 
formula is given by the following equations respectively. 
1 2 
1 
1 2 
1 
1 2 
1 
 
 
 
     
 
 
  
  
  
  
  
m i 
k i 
m 
i 
m i 
k i 
m 
i 
m i 
k i 
m 
i 
(7) 
and 
        
         
  
  
  
  
  
1 
1 
1 
1 
1 
1 
m i 
k i 
m 
i 
m i 
k i 
m 
i 
m i 
k i 
m 
i 
(8) 
Figs. 4 and 5 compare between the three similarity functions for the images greens and lifting-body, 
respectively. In this comparing we taken five template with different sizes from each 
reference and computing the time confused by each similarity function in our proposed method. 
As can be seen from Fig. 4, SSD function outperforms Euclidean and SAD functions but the
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
required time of the three functions is almost the same at template of sizes 25×25 and 150×150. 
Also, from Fig. 5, we can see that SSD function outperform Euclidean and SAD functions but the 
required time for the three functions is almost the same at template of sizes 25×25 and 200×200. 
Finally, from these two figures, we can see that for the two kind of images the SSD functions is 
the best because the number of operations of SSD is less than the number of operations in SAD 
and Euclidean (see Eqs. (3), (7) and (8)). 
50 
45 
40 
35 
30 
25 
20 
15 
10 
5 
Fig. 4. Comparisons between the three similarity functions on greens image using different size of template 
120 
100 
80 
time (secs) template size 
60 
40 
20 
Fig. 5. Comparisons between the three similarity functions on lifting-body image using different size of 
55 
template 
0 
25x25 50x50 100x100 150x150 150x200 
Eculdiean 
SSD 
SAD 
0 
25x25 50x50 100x100 150x150 200x200 
Eculdiean 
SSD 
SAD
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
The execution time required for the proposed and compared algorithms is shown in Tables I and 
II. These Tables shows the performance comparison of the above mentioned algorithms using 
color image of size 300×500 and gray scale image of size 512×512 respectively. For each 
reference image the templates are cropped with sizes from 25×25 to 200×200. From these Tables 
we see that the times in Table I is less than its corresponding times in Table II because the size of 
reference image in Tables I and II are 150000 and 262141 pixels respectively. In Table I the 
running time for NCCP and SADP algorithms for 150×150 template is greater than 200×200 
template although the converse must be satisfied. This result because the 150×150 template is 
very close the y-direction in greens image. NCCP and SADP give a better results than NCC and 
SAD when the template is far from the x-direction and y-direction in the reference image. 
56 
Table I Execution time by seconds of applying NCC, NCCP, SAD, SADP, and proposed 
method with five templates shown in fig. 2(b) and the reference image show in fig. 2(a). 
Template 
size 
Algorithm 
NCC NCCP SAD SADP Proposed 
25×25 18.95 8.97 5.12 3.03 1.06 
50×50 56.58 42.25 16.66 14.19 7.7 
100×100 158.28 75.16 45.87 24.78 23.17 
150×150 223.52 135.42 68.56 46.05 36.88 
150×200 255.05 121.17 78.92 41.52 38.92 
Table II Execution time by seconds of applying NCC, NCCP, SAD, SADP, and proposed 
method with five templates shown in fig. 3(b) and the reference image show in fig. 3(a). 
Template 
size 
Algorithm 
NCC NCCP SAD SADP Proposed 
25×25 35.52 21.26 10.31 6.81 2.26 
50×50 120.26 49.86 34.4 17.38 15.23 
100×100 339.05 213.23 104.19 75.12 50.39 
150×150 573.36 290.14 198.52 103.45 94.86 
200×200 779.91 349.09 241.12 129.27 106.6 
From table I, it is clarified that the processing time for the proposed is less than that for NCC, 
NCCP, SAD, and SADP. For example, using the 50×50 template, the processing time for the 
proposed was 7.7 s, however, NCC, NCCP, SAD, and SADP matching required 56.58, 42.25, 
16.66, and 14.19 s respectively. This means that the proposed give an improvement at least about 
50%. Also from table II the required time of the proposed is better than another all algorithms for 
all templates. Since the complexity of the proposed is more efficient than the other methods. Figs. 
6 and 7 shows the performance of the proposed algorithm compared with other four algorithms 
using greens image (color case) and lifting-body (gray scale case) respectively. It is clear that the 
proposed algorithm outperform the other in the two cases for all template sizes. In the above 
experiments, the correct match position is assumed to be the position where the minimum 
similarity distance value is obtained when the entire template is used in the search process.
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
57 
25x25 50x50 100x100 150x150 150x200 
template size 
NCC 
NCCP 
SAD 
SADP 
Proposed 
Fig. 6. Performance of the proposed algorithm using greens image 
300 
250 
200 
150 
100 
50 
0 
1000 
800 
600 
400 
200 
0 
25x25 50x50 100x100 150x150 200x200 
template size 
NCC 
NCCP 
SAD 
SADP 
Proposed 
Fig. 7. Performance of the proposed algorithm using lifting-body image 
time (secs) 
time (secs) 
4. CONCLUSION 
In this paper, we have proposed a new template matching which can be speed up the computation 
of block matching while still guaranteeing the correct match for template in the reference. To 
achieve efficient computation, we converted the template and each corresponding block in the 
reference from 2-D into 1-D. We have applied the proposed idea to the template matching using 
three different similarity measure, and have a reduction in computation time. Two different types 
of image (color and gray scale) are used for comparison between proposed algorithm and other 
algorithms. The templates are cropped from the reference image. The experimental results show 
the proposed algorithm is efficient for pattern matching under uniform illumination.
International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 
REFERENCES 
1. Mikhail, I. A.: Faster image template matching in the sum of the absolute value of differences 
58 
measures. IEEE Trans. Image Processing. 10(2), 659-663 (2001) 
2. Du-Ming, T., Chien-Ta, L.: Fast normalized cross correlation for detect detection. Pattern 
Recognition Letters 24, 2625-2631 (2003) 
3. Costa, C. E., Petrou, M.: Automatic registration of ceramic tiles for the propuse of fault detection. 
Machine Vision Application 11, 225-230 (2000) 
4. Li, R., Zeng, B., Liou, M. L.: A new three-step search algorithm for block motion estimation. IEEE 
Trans. Circuits Systems Video Technology, 4(4), 438-442 (1994) 
5. Mahmood, A., Khan, S.: Correlation coefficient based fast template matching through partial 
elimination. IEEE Trans. Image Processing. 21(4), 2099-2108 (2012) 
6. Chen, Y.S., Huang, Y.P., Fuh, C. S.: A fast block matching algorithm based on the winner-update 
strategy. IEEE Trans. Image Processing , 10(8), 1212-1222 (2001) 
7. Wei, S., Lai, S.: Fast template matching based on normalized cross correlation with adaptive 
multilevel winner update. IEEE Trans. Image Processing, 17(11), 2227-2235 (2008) 
8. Alsaade, F., Fouda, Y., Khan, A. R.: Efficient cellular automata algorithm for template matching. 
Journal of Artificial Intelligence, 5(3), 122-129 (2012) 
9. Essannouni, F.,Thami, R.O.H., Aboutajdine, D., Salam, A.: Adjustable SAD matching algorithm 
using frequency domain. J Real-Time Image Proc 1(4), 257-265 (2007) 
10. Alsaade, F., Fouda Y.: Template matching based on SAD and pyramid. International Journal of 
computer science and information security, 10(4), 11-16 (2012).

More Related Content

PDF
Long-Term Robust Tracking Whith on Failure Recovery
PDF
Image segmentation by modified map ml estimations
PDF
I0341042048
PDF
GRAPH PARTITIONING FOR IMAGE SEGMENTATION USING ISOPERIMETRIC APPROACH: A REVIEW
PDF
Graph Theory Based Approach For Image Segmentation Using Wavelet Transform
PDF
Architecture neural network deep optimizing based on self organizing feature ...
PDF
Performance Improvement of Vector Quantization with Bit-parallelism Hardware
PDF
Image similarity using fourier transform
Long-Term Robust Tracking Whith on Failure Recovery
Image segmentation by modified map ml estimations
I0341042048
GRAPH PARTITIONING FOR IMAGE SEGMENTATION USING ISOPERIMETRIC APPROACH: A REVIEW
Graph Theory Based Approach For Image Segmentation Using Wavelet Transform
Architecture neural network deep optimizing based on self organizing feature ...
Performance Improvement of Vector Quantization with Bit-parallelism Hardware
Image similarity using fourier transform

What's hot (17)

PDF
Kernel based similarity estimation and real time tracking of moving
PDF
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
PDF
Kandemir Inferring Object Relevance From Gaze In Dynamic Scenes
PPTX
Pillar k means
PPT
CenterForDomainSpecificComputing-Poster
PDF
Experimental analysis of matching technique of steganography for greyscale an...
PDF
A FLOATING POINT DIVISION UNIT BASED ON TAYLOR-SERIES EXPANSION ALGORITHM AND...
PDF
Dynamic approach to k means clustering algorithm-2
PDF
Comparative analysis and implementation of structured edge active contour
PDF
A1804010105
PDF
CORRELATION OF EIGENVECTOR CENTRALITY TO OTHER CENTRALITY MEASURES: RANDOM, S...
PDF
COLOR IMAGE ENCRYPTION BASED ON MULTIPLE CHAOTIC SYSTEMS
PDF
Lecture7 xing fei-fei
PDF
Energy minimization based spatially
PDF
IRJET-An Effective Strategy for Defense & Medical Pictures Security by Singul...
PPTX
Implement principal component analysis (PCA) in python from scratch
Kernel based similarity estimation and real time tracking of moving
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
Kandemir Inferring Object Relevance From Gaze In Dynamic Scenes
Pillar k means
CenterForDomainSpecificComputing-Poster
Experimental analysis of matching technique of steganography for greyscale an...
A FLOATING POINT DIVISION UNIT BASED ON TAYLOR-SERIES EXPANSION ALGORITHM AND...
Dynamic approach to k means clustering algorithm-2
Comparative analysis and implementation of structured edge active contour
A1804010105
CORRELATION OF EIGENVECTOR CENTRALITY TO OTHER CENTRALITY MEASURES: RANDOM, S...
COLOR IMAGE ENCRYPTION BASED ON MULTIPLE CHAOTIC SYSTEMS
Lecture7 xing fei-fei
Energy minimization based spatially
IRJET-An Effective Strategy for Defense & Medical Pictures Security by Singul...
Implement principal component analysis (PCA) in python from scratch
Ad

Viewers also liked (14)

PDF
P REDICTION F OR S HORT -T ERM T RAFFIC F LOW B ASED O N O PTIMIZED W...
PDF
ARABIC LANGUAGE CHALLENGES IN TEXT BASED CONVERSATIONAL AGENTS COMPARED TO TH...
PPTX
Gum Uses In Medicine
PDF
FOLLOWING CAR ALGORITHM WITH MULTI AGENT RANDOMIZED SYSTEM
PDF
Samuel collection cream leather sofa by coaster furniture
PPTX
Quantum Leap Opening Remarks
DOC
Top 7 marketing specialist interview questions answers
PPTX
Website to get followers on keek
PPTX
Website get more followers keek
PPTX
Websites for free keek followers
PDF
SECURITY THREATS ON CLOUD COMPUTING VULNERABILITIES
PDF
Study On Decision-Making For Café Management Alternatives
PDF
Ijcsit(most cited articles)
PDF
Survey of the Euro Currency Fluctuation by Using Data Mining
P REDICTION F OR S HORT -T ERM T RAFFIC F LOW B ASED O N O PTIMIZED W...
ARABIC LANGUAGE CHALLENGES IN TEXT BASED CONVERSATIONAL AGENTS COMPARED TO TH...
Gum Uses In Medicine
FOLLOWING CAR ALGORITHM WITH MULTI AGENT RANDOMIZED SYSTEM
Samuel collection cream leather sofa by coaster furniture
Quantum Leap Opening Remarks
Top 7 marketing specialist interview questions answers
Website to get followers on keek
Website get more followers keek
Websites for free keek followers
SECURITY THREATS ON CLOUD COMPUTING VULNERABILITIES
Study On Decision-Making For Café Management Alternatives
Ijcsit(most cited articles)
Survey of the Euro Currency Fluctuation by Using Data Mining
Ad

Similar to One dimensional vector based pattern (20)

PDF
Efficient 3D stereo vision stabilization for multi-camera viewpoints
PDF
Disparity Estimation by a Real Time Approximation Algorithm
PDF
EXTENDED WAVELET TRANSFORM BASED IMAGE INPAINTING ALGORITHM FOR NATURAL SCENE...
PDF
Survey paper on image compression techniques
PDF
Fuzzy Type Image Fusion Using SPIHT Image Compression Technique
PDF
A comparative analysis of retrieval techniques in content based image retrieval
PDF
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
PDF
CUDA Accelerated Face Recognition
PDF
Real-Time Face Tracking with GPU Acceleration
PDF
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
PDF
Stereo matching algorithm using census transform and segment tree for depth e...
PDF
Development and Comparison of Image Fusion Techniques for CT&MRI Images
PDF
International Journal of Engineering Research and Development (IJERD)
PDF
BEHAVIOR STUDY OF ENTROPY IN A DIGITAL IMAGE THROUGH AN ITERATIVE ALGORITHM O...
PDF
A NOVEL APPROACH TO SMOOTHING ON 3D STRUCTURED ADAPTIVE MESH OF THE KINECT-BA...
PDF
POSTERIOR RESOLUTION AND STRUCTURAL MODIFICATION FOR PARAMETER DETERMINATION ...
PDF
Paper 58 disparity-of_stereo_images_by_self_adaptive_algorithm
PDF
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
PDF
Stereo Correspondence Estimation by Two Dimensional Real Time Spiral Search A...
PDF
Medial axis transformation based skeletonzation of image patterns using image...
Efficient 3D stereo vision stabilization for multi-camera viewpoints
Disparity Estimation by a Real Time Approximation Algorithm
EXTENDED WAVELET TRANSFORM BASED IMAGE INPAINTING ALGORITHM FOR NATURAL SCENE...
Survey paper on image compression techniques
Fuzzy Type Image Fusion Using SPIHT Image Compression Technique
A comparative analysis of retrieval techniques in content based image retrieval
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
CUDA Accelerated Face Recognition
Real-Time Face Tracking with GPU Acceleration
Introducing New Parameters to Compare the Accuracy and Reliability of Mean-Sh...
Stereo matching algorithm using census transform and segment tree for depth e...
Development and Comparison of Image Fusion Techniques for CT&MRI Images
International Journal of Engineering Research and Development (IJERD)
BEHAVIOR STUDY OF ENTROPY IN A DIGITAL IMAGE THROUGH AN ITERATIVE ALGORITHM O...
A NOVEL APPROACH TO SMOOTHING ON 3D STRUCTURED ADAPTIVE MESH OF THE KINECT-BA...
POSTERIOR RESOLUTION AND STRUCTURAL MODIFICATION FOR PARAMETER DETERMINATION ...
Paper 58 disparity-of_stereo_images_by_self_adaptive_algorithm
A PROJECT REPORT ON REMOVAL OF UNNECESSARY OBJECTS FROM PHOTOS USING MASKING
Stereo Correspondence Estimation by Two Dimensional Real Time Spiral Search A...
Medial axis transformation based skeletonzation of image patterns using image...

Recently uploaded (20)

PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
Big Data Technologies - Introduction.pptx
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Encapsulation theory and applications.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
Approach and Philosophy of On baking technology
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Machine learning based COVID-19 study performance prediction
PPTX
1. Introduction to Computer Programming.pptx
Programs and apps: productivity, graphics, security and other tools
Big Data Technologies - Introduction.pptx
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
MYSQL Presentation for SQL database connectivity
Digital-Transformation-Roadmap-for-Companies.pptx
Spectroscopy.pptx food analysis technology
Encapsulation theory and applications.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
NewMind AI Weekly Chronicles - August'25-Week II
Approach and Philosophy of On baking technology
Advanced methodologies resolving dimensionality complications for autism neur...
MIND Revenue Release Quarter 2 2025 Press Release
Diabetes mellitus diagnosis method based random forest with bat algorithm
20250228 LYD VKU AI Blended-Learning.pptx
Machine learning based COVID-19 study performance prediction
1. Introduction to Computer Programming.pptx

One dimensional vector based pattern

  • 1. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 ONE-DIMENSIONAL VECTOR BASED PATTERN MATCHING Y. M. Foudaa,b a College of Computer Science and Information Technology, King Faisal University, P.O. Box 400, Al-Ahsa 31982, Kingdom of Saudi Arabia. b Mathematics Department, Faculty of Science, Mansoura University, Mansoura 35516, Egypt. ABSTRACT Template matching is a basic method in image analysis to extract useful information from images. In this paper, we suggest a new method for pattern matching. Our method transform the template image from two dimensional image into one dimensional vector. Also all sub-windows (same size of template) in the reference image will transform into one dimensional vectors. The three similarity measures SAD, SSD, and Euclidean are used to compute the likeness between template and all sub-windows in the reference image to find the best match. The experimental results show the superior performance of the proposed method over the conventional methods on various template of different sizes. KEY WORDS Image analysis, pattern matching, likeness functions, vector sum. 1. INTRODUCTION Pattern matching is an important technique in pattern recognition and image processing. It is used in many applications related to signal processing and machine vision such as object tracking, stereo matching, video compression, image retrieval and image registration. Template matching tries to answer one of the most basic questions about image: Is there a certain object in that image? If so, where? The template is a description of that object, and is used to search the image by computing a difference measure between the template and all possible portions of the image that could match the template: if any of these produces a small difference, then it is viewed as possible occurrence of the object[1]. Various difference measures have different mathematical properties, and different computational properties had been used to find the best match. 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 of 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 measure are sensitive to outliers and is not robust to variations in the template, such as those that occur at occluding boundaries in the image. However, the NCC measure is more accurate but it is computationally slow. It is more robust than SAD and SSD under uniform illumination changes, DOI:10.5121/ijcsit.2014.6404 47
  • 2. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 so the NCC measure has been widely used in object recognition and industrial inspection such as in [2] and [3]. 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 [4]. Many improvements were occurred on SAD and NCC algorithms to get a better complexity. Mahmood and Khan [5] proposed a partial computation elimination technique in which at a particular search location, computations are prematurely terminated as soon as it is found that this location cannot compete already known best-match location. They showed that partial elimination technique may be applied to correlation coefficient by using a monotonic formulation and proposed a basic mode for small template size and an extended mode for medium and larger template. Chen et al. [6] proposed a fast block matching algorithm based on the winner-update strategy, which can significantly reduce the computation and guarantee to find the globally optimal solution. In their algorithm, only the current winner location with a minimal accumulated distortion is considered for updating the accumulated distortion. This updating process is repeated until the winner has gone through all levels in the pyramids that are constructed from the template and all the candidate windows for the distortion calculation. Wei and Lai [7] proposed a fast pattern matching algorithm based on NCC criterion by combing adaptive multilevel partition with the winner update scheme to achieve very efficient search. This winner update scheme is applied in conjunction with an upper bound for the cross correlation derived from Cauchy-Schwarz inequality. To apply the winner update scheme in an efficient way, they partition the summation of cross correlation into different levels with the partition order determined by the gradient energies of the partitioned regions in the template. Thus, this winner update scheme in conjunction with the upper bound for NCC can be employed to skip unnecessary calculation. Alsaade and Fouda [8] used Cellular Automata with Rule 170 (CA-R170) on the images after converting it into binary images. Your technique based on eliminating some of the undesirable area in the binary reference images and their corresponding binary template images. Essannouni et. al. [9] proposed a frequency algorithm to speed up the process of SAD matching using Fast Fourier transforms (FFT). They introduced an approach to approximate the SAD metric by cosine series which can be expressed in correlation terms. These latter can be computed using FFT algorithms. Alsaade and Fouda [10] proposed a matching algorithm based on SAD as a measure of similarity and pyramid structure. They applied the pyramid concept to obtain a number of levels of original and template images. Then the SAD measure is applied for each level of image from bottom to up to obtain the correct match in the original image. In this paper, we propose an efficient pattern search algorithm based on Dimension-Reduction approach for images. Dimension-Reduction technique is applied for the template image and all corresponding sub-windows in the reference image. In our approach Dimensions-Reduction technique based on converting the template and all its corresponding sub-windows in the reference from 2-D into 1-D. The sum of square difference measure was used as a similarity measure to get the template in the reference. The rest of the paper is organized as follows: the proposed algorithm and its complexity analysis is described in section II. Simulation and comparison results for NCC and SAD standards are reported in section III. Then we state conclusions in section IV. 48
  • 3. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 2 . THE MAIN CONTRIBUTION In this section we introduce description of the proposed method followed by its complexity analysis compared with other four methods. 2.1 The proposed method Our method has been motivated by a need to develop an efficient matching technique so that the detection of objects in a reference image can be effective and fast. The proposed matching algorithm involves three phases. Phase I reduce the amount of data analyzed by transforming 2-D images (template image and sub-windows which has the same size with template in the reference image) into 1-D vector information. This can be done by adding all intensity values for each column in 2-D image see Eq. (1), so we get 1-D vector information. This vector information will be used in the matching process instead of the 2-D image. This transforming reduce the amount of image from m × n to n. Subsequently, this allows the search to be performed with fewer data, while still taking all pixel intensity values into account. Phase II measure the likeness between template image and all possible sub-windows in the reference image. The Euclidean distance or sum of absolute difference or sum of square difference can be used as a similarity measure between 1-D template and all 1-D converted sub-window in the reference. Phase III the decision will be taken based on the similarity values. The sub-window in the reference with minimum similarity value will be the best match for template in the reference. The basic idea of the proposed template matching depending on converting 2-D template image into 1-D and also the corresponding windows in the reference image over which the template lies. To illustrate the idea suppose that we have a reference image S of size p×q and template image T of size m× n where m < p and n < q. The problem is to find the best match of template T from the reference image S with minimum distortion. ( ) ( ,1), ( ,2), ( ,3),, ( , ) (1) NW i j W k j W k j W k j  W k n j (2) 49 First the template image T(i,j) converted to 1-D vector NT by the equation        NT i T i T i T i T i n  m i m i m i m     i 1 1 1 1 where T(i,j) is the pixel value at location (i,j) of the template image. Secondly, for each pixel (i,j) in the reference image S, 1 ≤ i <p-m and 1 ≤ j <q-n, we determine a window W(i,j) of size m×n and all these windows converted into 1-D vector NW by the equation                m i           1 1 1 1 ( , ) ( , ), ( , 1), ( , 2), , ( , 1) k i m i k i m i k i m i k i where W(k,j) is the pixel value at location (k,j) of the reference image. Thirdly, the likeness between template image and each corresponding window in the reference are measured by sum of square difference distance between NT and NW. All these distances compute and store in new storage C(i,j) where
  • 4. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 1 2                  C i j W k j T i W k j T i  W k n j T i n ) , ( ) 1 , ( ) 2 , ( ) 1 , ( ) 1 , ( ) , ( ) , (  50 1 1 2 1 1 2 1                 m i k i m i m i k i m i m i k i m i where 1 ≤ i < p-m and 1 ≤ j < q-n. (3) If the positive ordered pair (i, j) be such that C(i, j) is the lowest obtained distance, then return (i, j) as the left upper corner of best template match in our proposed method. Fig. (1) show the concept of the proposed method. Fig. 1: Illustration of the proposed. The template image is converted into 1-D and also the corresponding windows in the reference, SSD is calculated at every possible location in the reference. The (i,j) location of matrix C with the minimum value is considered as the location of best match.
  • 5. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 2.2 Complexity analysis In order to evaluate the efficiency of the proposed algorithm, we discuss the complexity of our algorithm compared with four important methods of template matching NCC, SAD, NCCP, and SADP. For NCC algorithm, the cross correlation coefficient between template image T of size n×n pixels and an n×n pixels block in reference image S of size p×q is given by: ( , ) ( , ) ( , ) (5) I k (x, y)  1 I k1 x y  I k1 x  y  I k1 x y   I k1 x  y  (6) 51     ( , ) ( , ) ( , ) ( , ) , 1≤i<(p-n), 1≤j<(q-n) 1 1 ( , ) ( , ) ( , )   S i  x j  y  S i j T x y  T     2 2          n x n y n x n y n x n y S i x j y S i j T x y T i j 1 1 1 1 (4) where ( , ) 1 ( , ) 1 ( , )             n x n y n x n y T x y n n S i x j y and T n n S i j 1 1 1 1 Direct computation of λ(i,j) require n×n=n2 (addition/ multiplication) operations at each point (i,j) in the reference image where 1≤ i<(p-n), 1≤ j<(q-n) . Then the operations in Eq. (4) is proportional to n2(p-n+1)(q-n+1). So the computational cost of NCC is Ο(n2(p-n+1)(q-n+1)) which is very time consuming. For SAD method the sum of absolute difference between the template T of size n×n pixels and blocks of sizes n×n pixels in the reference image S is given by: n     SAD i j  S i  x j  y  T x y x n y 1 1 The computation of SAD(i,j) requires a number of operations proportional to the template area (n×n). These operations are computed for each (i,j) in the reference image where 1≤ i<(p-n), 1≤ j<(q-n). Then the computational cost for SAD method is Ο(n2(p-n+1)(q-n+1)) the same in NCC algorithm but the SAD method is faster than NCC method because the number of operations in SAD is less than number of operations in NCC for each position (i,j) in the reference image about seventy percentage. The two methods NCCP and SADP can achieve the same estimation accuracy as NCC and SAD while needing much less computation requirement than theses two methods. When the pyramid is applied for NCC and SAD, a sequence of compressed template and reference images are created using:  (2 ,2 ) (2 1,2 ) (2 ,2 1) (2 1,2 1) 4 where Ik(x,y) is the intensity value for the image in the level k. The search is conduct using NCC or SAD (Eq. (4) or (5)) with the most compressed template and reference image. The resulting pixel location provides a coarse location of the template pattern in the next lower level of the
  • 6. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 reference image. Therefore, instead of performing a complete search in the next level, one require to only search a close neighborhood of the area computed from the previous search. This sequence is iterated until the search in the reference image is searched. In the pyramid concept the complexity of the algorithm depend on the position of template in the reference. If the template coordinates is far from the x-direction and y-direction then applying pyramid outperform the original method. But, if the x-coordinate for template in reference is close to x-axis and/or y-coordinate for template in reference is close y-axis the original method outperform the pyramid concept. To overcome the problem in pyramid concept and the computational intensive in NCC and SAD we introduced our approach. The computation in Eq.(3) require a number of operations proportional to the length n of the converted vector from 2-D into 1-D. These operations are computed for each position (i,j) in the reference image where 1≤ i<(p-n), 1≤ j<(q-n). Then the computational cost of the proposed method is Ο(n(p-n+1)(q-n+1)) and this justify why the proposed method outperform the others. 3 EXPERIMENTAL RESULTS To measure the efficiency the proposed method was implemented. For the comparing purpose, we also implemented four different algorithms the full-search NCC algorithm, NCC pyramid (NCCP) algorithm, sum of absolute difference (SAD) algorithm, and SAD pyramid (SADP) algorithm. Theses algorithms were implemented in a Matlab 7.0 on a Laptop with an Intel® Core™2 Duo CPU T7500 @ 2.20 GHz and 1.99 GB RAM. Two types of images are used for the testing purpose color images and gray scale images. Greens image of size 300×500 is a representative for color case see fig. 2(a). Lifting-body of size 512×512 is a representative for gray scale case see Fig. 3(a). In our experiments we cropped the templates from the reference (see Fig. 2(b) and Fig. 3(b)) so we know in advance the correct position for template in the reference. The size of these templates varying from 25×25 to 200×200 pixels. 52 (a)
  • 7. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 53 (b) Fig. 2. (a) Original greens image and (b) The cropped template images form the original with sizes varying from 25x25 to 150x200 pixels. (a)
  • 8. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014               C i j W k j T i W k j T i  W k n j T i n ) , ( ) 1 , ( ) 2 , ( ) 1 , ( ) 1 , ( ) , ( ) , (  C i j W k j T i W k j T i  W k n j T i n ( , ) ( , ) ( ,1) ( , 1) ( ,2) ( , 1) ( , ) 54 (b) Fig. 3. (a) Original Lifting-body image and (b) The cropped template images form the original with sizes varying from 25x25 to 200x200 pixels. In the clean data, the proposed and compared algorithms are guaranteed to find the correct match from the reference image, so we only focus on the comparison of search time required for these algorithms. In the proposed method the similarity between template and sub-windows in the reference image can be measure using more than one similarity function. For example the Euclidean distance or sum of absolute difference or sum of square difference can be used. The mathematical formula for sum of square difference are used in our method (see Eq. (3)). To apply the Euclidean distance and sum of absolute difference functions in our method their mathematical formula is given by the following equations respectively. 1 2 1 1 2 1 1 2 1                     m i k i m i m i k i m i m i k i m i (7) and                            1 1 1 1 1 1 m i k i m i m i k i m i m i k i m i (8) Figs. 4 and 5 compare between the three similarity functions for the images greens and lifting-body, respectively. In this comparing we taken five template with different sizes from each reference and computing the time confused by each similarity function in our proposed method. As can be seen from Fig. 4, SSD function outperforms Euclidean and SAD functions but the
  • 9. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 required time of the three functions is almost the same at template of sizes 25×25 and 150×150. Also, from Fig. 5, we can see that SSD function outperform Euclidean and SAD functions but the required time for the three functions is almost the same at template of sizes 25×25 and 200×200. Finally, from these two figures, we can see that for the two kind of images the SSD functions is the best because the number of operations of SSD is less than the number of operations in SAD and Euclidean (see Eqs. (3), (7) and (8)). 50 45 40 35 30 25 20 15 10 5 Fig. 4. Comparisons between the three similarity functions on greens image using different size of template 120 100 80 time (secs) template size 60 40 20 Fig. 5. Comparisons between the three similarity functions on lifting-body image using different size of 55 template 0 25x25 50x50 100x100 150x150 150x200 Eculdiean SSD SAD 0 25x25 50x50 100x100 150x150 200x200 Eculdiean SSD SAD
  • 10. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 The execution time required for the proposed and compared algorithms is shown in Tables I and II. These Tables shows the performance comparison of the above mentioned algorithms using color image of size 300×500 and gray scale image of size 512×512 respectively. For each reference image the templates are cropped with sizes from 25×25 to 200×200. From these Tables we see that the times in Table I is less than its corresponding times in Table II because the size of reference image in Tables I and II are 150000 and 262141 pixels respectively. In Table I the running time for NCCP and SADP algorithms for 150×150 template is greater than 200×200 template although the converse must be satisfied. This result because the 150×150 template is very close the y-direction in greens image. NCCP and SADP give a better results than NCC and SAD when the template is far from the x-direction and y-direction in the reference image. 56 Table I Execution time by seconds of applying NCC, NCCP, SAD, SADP, and proposed method with five templates shown in fig. 2(b) and the reference image show in fig. 2(a). Template size Algorithm NCC NCCP SAD SADP Proposed 25×25 18.95 8.97 5.12 3.03 1.06 50×50 56.58 42.25 16.66 14.19 7.7 100×100 158.28 75.16 45.87 24.78 23.17 150×150 223.52 135.42 68.56 46.05 36.88 150×200 255.05 121.17 78.92 41.52 38.92 Table II Execution time by seconds of applying NCC, NCCP, SAD, SADP, and proposed method with five templates shown in fig. 3(b) and the reference image show in fig. 3(a). Template size Algorithm NCC NCCP SAD SADP Proposed 25×25 35.52 21.26 10.31 6.81 2.26 50×50 120.26 49.86 34.4 17.38 15.23 100×100 339.05 213.23 104.19 75.12 50.39 150×150 573.36 290.14 198.52 103.45 94.86 200×200 779.91 349.09 241.12 129.27 106.6 From table I, it is clarified that the processing time for the proposed is less than that for NCC, NCCP, SAD, and SADP. For example, using the 50×50 template, the processing time for the proposed was 7.7 s, however, NCC, NCCP, SAD, and SADP matching required 56.58, 42.25, 16.66, and 14.19 s respectively. This means that the proposed give an improvement at least about 50%. Also from table II the required time of the proposed is better than another all algorithms for all templates. Since the complexity of the proposed is more efficient than the other methods. Figs. 6 and 7 shows the performance of the proposed algorithm compared with other four algorithms using greens image (color case) and lifting-body (gray scale case) respectively. It is clear that the proposed algorithm outperform the other in the two cases for all template sizes. In the above experiments, the correct match position is assumed to be the position where the minimum similarity distance value is obtained when the entire template is used in the search process.
  • 11. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 57 25x25 50x50 100x100 150x150 150x200 template size NCC NCCP SAD SADP Proposed Fig. 6. Performance of the proposed algorithm using greens image 300 250 200 150 100 50 0 1000 800 600 400 200 0 25x25 50x50 100x100 150x150 200x200 template size NCC NCCP SAD SADP Proposed Fig. 7. Performance of the proposed algorithm using lifting-body image time (secs) time (secs) 4. CONCLUSION In this paper, we have proposed a new template matching which can be speed up the computation of block matching while still guaranteeing the correct match for template in the reference. To achieve efficient computation, we converted the template and each corresponding block in the reference from 2-D into 1-D. We have applied the proposed idea to the template matching using three different similarity measure, and have a reduction in computation time. Two different types of image (color and gray scale) are used for comparison between proposed algorithm and other algorithms. The templates are cropped from the reference image. The experimental results show the proposed algorithm is efficient for pattern matching under uniform illumination.
  • 12. International Journal of Computer Science & Information Technology (IJCSIT) Vol 6, No 4, August 2014 REFERENCES 1. Mikhail, I. A.: Faster image template matching in the sum of the absolute value of differences 58 measures. IEEE Trans. Image Processing. 10(2), 659-663 (2001) 2. Du-Ming, T., Chien-Ta, L.: Fast normalized cross correlation for detect detection. Pattern Recognition Letters 24, 2625-2631 (2003) 3. Costa, C. E., Petrou, M.: Automatic registration of ceramic tiles for the propuse of fault detection. Machine Vision Application 11, 225-230 (2000) 4. Li, R., Zeng, B., Liou, M. L.: A new three-step search algorithm for block motion estimation. IEEE Trans. Circuits Systems Video Technology, 4(4), 438-442 (1994) 5. Mahmood, A., Khan, S.: Correlation coefficient based fast template matching through partial elimination. IEEE Trans. Image Processing. 21(4), 2099-2108 (2012) 6. Chen, Y.S., Huang, Y.P., Fuh, C. S.: A fast block matching algorithm based on the winner-update strategy. IEEE Trans. Image Processing , 10(8), 1212-1222 (2001) 7. Wei, S., Lai, S.: Fast template matching based on normalized cross correlation with adaptive multilevel winner update. IEEE Trans. Image Processing, 17(11), 2227-2235 (2008) 8. Alsaade, F., Fouda, Y., Khan, A. R.: Efficient cellular automata algorithm for template matching. Journal of Artificial Intelligence, 5(3), 122-129 (2012) 9. Essannouni, F.,Thami, R.O.H., Aboutajdine, D., Salam, A.: Adjustable SAD matching algorithm using frequency domain. J Real-Time Image Proc 1(4), 257-265 (2007) 10. Alsaade, F., Fouda Y.: Template matching based on SAD and pyramid. International Journal of computer science and information security, 10(4), 11-16 (2012).