SlideShare a Scribd company logo
1. INTRODUCTION 
Template matching is a technique in computer vision used for finding a sub-image 
of a target image which matches a template image. This technique is 
widely used in object detection fields such as vehicle tracking, robotics , 
medical imaging, and manufacturing . 
The crucial point is to adopt an appropriate “measure” to quantify similarity 
or matching. However, this method also requires extensive computational 
cost since the matching process involves moving the template image to all 
possible positions in a larger target image and computing a numerical index 
that indicates how well the template matches the image in that position. This 
problem is thus considered as an optimization problem. 
A reasonable first step to approaching such a task is to define a measure or 
a cost measuring the“distance”or the“similarity”between the (known) 
reference patterns and the (unknown) test pattern, in order to perform the 
matching operation known as template matching. 
Pattern Recognition – TM Page | 2
2. Template Matching Types 
Template matching has been performed at the pixel level and also on higher 
level. 
A. Pixel Level Template Matching: 
Pixel templates come in four types: 
a) Total templates: Template is the same size as the input image. 
There is no rotation or translation invariance. 
b) Partial templates: Template is free from the background. Multiple 
matches are allowed. Partial matches may also be allowed. Care 
must be taken in this case -- an F template could easily match to 
an E. 
Template 
Image 
Pattern Recognition – TM Page | 3
c) Piece templates : Templates that match one feature of a figure. 
These templates break a pattern into its component segments so, 
for example, "A" can be broken down into "/", "" and "-". The 
order in which templates are compared to the scene is important: 
the largest templates must be tried first, since they contain the 
most information and may subsume smaller templates. 
d) Flexible templates: These templates can handle stretching, 
misorientation and other possible deviations. A good prototype of 
a known object is first obtained and represented parametrically. 
Pattern Recognition – TM Page | 4
B. High Level Template Matching 
A problem with pixel based is that although fairly cheap and simple to 
implement; rotation and translation is a problem, also images are rarely 
perfect suffering from blurring, stretched and other distortions and 
peppered with noise. 
High level template matching methods operate on an image that has 
typically been segmented into regions of interest. Regions can be described 
in terms of area, average intensity, rate of change of intensity, curvature and 
also compared -- bigger than, adjacent to, above, distance between. 
Templates are described in relationships between regions. Production rules 
and other linguistic representations have been used. Also statistical methods 
(relaxation based techniques) have been applied to perform the matching. 
a) Feature-based Matching: When the template image has strong 
features, a feature-based approach may be considered; the approach 
may prove further useful if the match in the search image might be 
transformed in some fashion. Since this approach does not consider 
the entirety of the template image, it can be more computationally 
efficient when working with source images of larger resolution. 
Pattern Recognition – TM Page | 5
b) Template-based Matching: For templates without strong features, or 
for when the bulk of the template image constitutes the matching 
image, a template-based approach may be effective. Template-based 
template matching may potentially require sampling of a large 
number of points, it is possible to reduce the number of sampling 
points by reducing the resolution of the search and template images 
by the same factor and performing the operation on the resultant 
downsized images (multi-resolution, or pyramid, image processing). 
 Image Pyramid 
Image Pyramid is a series of images, each image being a result of 
downsampling (scaling down, by the factor of two in this case) of the 
previous element. 
 Pyramid Processing 
 At each level of the pyramid, we will need appropriately downsampled 
picture of the reference template, i.e. both input image pyramid and 
template image pyramid (Pyramid Processing) should be computed. 
Pattern Recognition – TM Page | 6
 Grayscale-based Matching 
Although in some of the applications the orientation of the objects is 
uniform and fixed (as we have seen in the plug example), it is often the 
case that the objects that are to be detected appear rotated. In Template 
Matching algorithms the classic pyramid search is adapted to allow multi-angle 
matching, i.e. identification of rotated instances of the template. 
This is achieved by computing not just one template image pyramid, but a 
set of pyramids - one for each possible rotation of the template. During the 
pyramid search on the input image the algorithm identifies the 
pairs (template position, template orientation) rather than sole template 
positions. Similarly to the original schema, on each level of the search the 
algorithm verifies only those (position, orientation)pairs that scored well on 
the previous level (i.e. seemed to match the template in the image of lower 
resolution). 
The technique of pyramid matching together with multi-angle search 
constitute the Grayscale-based Template Matching method. 
Pattern Recognition – TM Page | 7
 Edge-based Matching 
Edge-based Matching enhances the previously discussed Grayscale-based 
Matching using one crucial observation - that the shape of any object is 
defined mainly by the shape of its edges. Therefore, instead of matching 
of the whole template, we could extract its edges and match only the 
nearby pixels, thus avoiding some unnecessary computations. In common 
applications the achieved speed-up is usually significant. 
3. Template Matching Measures 
Measure of match between two images is considered to be a metric that 
indicate the degree of similarity or dissimilarity between them. Unless it is 
specifically stated otherwise, this metric can be increasing or decreasing with 
degree of similarity. Where the metric is specifically stated to be a measure 
of mismatch, it is a quantity that is increasing with the degree of dissimilarity. 
Pattern Recognition – TM Page | 8
3.1 Measures of Match (similarity) 
1) MEASURES BASED ON OPTIMAL PATH SEARCHING TECHNIQUES 
Representation: Represent the template by a sequence of measurement 
vectors. 
Template: 
Test pattern: 
r(1), r(2),..., r(I ) 
t(1), t(2),..., t(J ) 
I  J 
 Form a grid with I points (template) in horizontal and J points (test) 
in vertical 
 Each point (i,j) of the grid measures the distance between r(i) and t(j) 
 Path: A path through the grid, from an initial node 
(i0, j0) to a final one (if, jf), is an ordered set of nodes 
(i0, j0), (i1, j1), (i2, j2) … (ik, jk) … (if, jf) 
 Each path is associated with a cost 
K  
1 
 
k k D d( i , j ) 
k  
0 
 
Where K is the number of nodes across the path 
Pattern Recognition – TM Page | 9
The optimal path (blue) is constructed by searching among all allowable 
paths. The optimal node correspondence, between the test and reference 
patterns, is unraveled by backtracking the optimal path. 
2) Euclidean Distance 
Let I be a gray level image and g be a gray-value template of size n X m. 
In this formula (r,c) denotes the top left corner of template g. 
3) The Edit Distance 
Deals with patterns that consist of sets of ordered symbols. For example,if 
these symbols are letters,then the patterns are words from a written text. 
Such problems arise in automatic editing and text retrieval applications. 
Other examples of symbol strings occur in structural pattern recognition. 
Once the symbols of a (test) pattern have been identified, for example, via a 
reading device, the task is to recognize the pattern, searching for the best 
match of it against a set of reference patterns. 
Pattern Recognition – TM Page | 10
■ Wrongly identified symbol (e.g.,“befuty” instead of “beauty”) 
■ Insertion error (e.g.,“bearuty”) 
■ Deletion error (e.g.,“beuty”) 
The similarity between two patterns is based on the “cost” associated with 
converting one pattern to the other. If the patterns are of the same length, 
then the cost is directly related to the number of symbols that have to be 
changed in one of them so that the other pattern results. 
The Edit distance between two string patterns A and B, denoted D(A, B), is 
defined as the minimum total number of changes C, insertions I ,and 
deletions R required to change pattern A into pattern B, 
D(A,B)  min[C( j)  I ( j)  
R( j)] 
j 
Where j runs over all possible variations of symbols, in order to convert A 
B. 
Computation of the Edit distance with (a) an insertion, (b) a change, (c) a 
deletion, and (d) an equality. 
Pattern Recognition – TM Page | 11
 Allowable predecessors and costs 
1. Diagonal transitions: 
t i r j 
0, if ( ) ( ) 
 
 
 
t i r j 
1, ( )  
( ) 
 
d i j i j 
( , 1, 1) 
   
2. Horizontal and vertical transitions: 
d(i, j i 1, j) 1 
d(i, j i, j 1) 1 
4) MEASURES BASED ON CORRELATIONS 
The major task here is to find whether a specific known reference pattern 
resides within a given block of data. Such problems arise in problems such as 
target detection, robot vision, video coding. There are two basic steps in 
such a procedure: 
 Step 1: Move the reference pattern to all possible positions within the 
block of data. For each position, compute the “similarity” between the 
reference pattern and the respective part of the block of data. 
Pattern Recognition – TM Page | 12
 Step 2: Compute the best matching value. 
  
N 
i i 
 
 
x x y y 
( ) 
   
 
 
 
1 
1 
N 
i 
2 2 
1 
0 
N 
    
 
x  x  y  
y 
i i 
 
 
0 
0 
i 
i 
cor 
  
x 
 
x  y  y x is the template gray level image 
2 2 
    
  i 
i Pattern Recognition – TM Page | 13 
 
 
 
 
 
 
 
   
1 
0 
1 
0 
1 
0 
) ( 
N 
i 
N 
i 
i 
N 
i i 
y y x x 
is the average grey level in the template image 
y is the source image section 
y is the average grey level in the source image 
N is the number of pixels in the section image 
(N= template image size = columns * rows) 
The value cor is between –1 and +1, 
with larger values representing a stronger relationship between the two images.
3.2 Measures of Mismatch (dissimilarity) 
These measures of match are based on the pixel-by-pixel intensity 
differences between the two images f and g. 
1) Root mean square distance (RMS): The RMS distance metric is a 
common measure of mismatch between two digital images. It is given 
by: 
2) Sum of absolute differences (SAD): compare the intensities of the 
pixels to handle translation problems on images, using template 
matching. 
A pixel in the search image with coordinates (xs, ys) has intensity Is(xs, ys) and 
a pixel in the template with coordinates (xt, yt) has intensity It(xt, yt ). Thus 
the absolute difference in the pixel intensities is defined as 
Diff(xs, ys, x t, y t) = | Is(xs, ys) – It(x t, y t) |. 
Pattern Recognition – TM Page | 14
4. Problems with template matching 
1) The template represents the object as we expect to find it in the image 
2) The object can indeed be scaled or rotated 
3) This technique requires a separate template for each scale and 
orientation 
4) Template matching become thus too expensive, especially for large 
templates 
5) Sensitive to: 
–noise 
–occlusions 
Pattern Recognition – TM Page | 15
5. Template Matching Applications: 
1) Template matching with various average face pyramid levels. 
2) 3D reconstruction. 
3) Motion detection. 
4) Object recognition. 
5) Panorama reconstruction. 
Pattern Recognition – TM Page | 16
Reference: 
1. G.s.cox,1995. “ template matching and measures of match in image 
processing”,July 12 . cape town university. 
2. https://www.adaptivevision.com/pl/dane_techniczne/dokumentacja 
/3.2/machine_vision_guide/TemplateMatching.html 
3. http://numerics.mathdotnet.com/docs/Distance.html 
4. http://www-cs-students. 
stanford.edu/~pdoyle/quail/notes/pdoyle/vision.html#Te 
mplate Matching 
5. http://en.wikipedia.org/wiki/Template_matching 
6. http://www.lira.dist.unige.it/teaching/SINA/slides-current/interest-points. 
pdf 
7. OpenCV 2.4.5.0 documentation.htm 
8. Jain. D, Tolga. H, and Meiyappan. S, “Face Detection using Template 
Matching”, , EE 368 – Digital Image Processing, Spring 2002-2003. 
Pattern Recognition – TM Page | 17

More Related Content

What's hot

SPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSINGSPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSING
muthu181188
 
Psuedo color
Psuedo colorPsuedo color
Psuedo color
Mariashoukat1206
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image Compression
Mathankumar S
 
Image segmentation
Image segmentationImage segmentation
Image segmentationDeepak Kumar
 
Chapter 9 morphological image processing
Chapter 9   morphological image processingChapter 9   morphological image processing
Chapter 9 morphological image processing
Ahmed Daoud
 
Histogram Equalization
Histogram EqualizationHistogram Equalization
Histogram Equalization
Kalyan Acharjya
 
Features image processing and Extaction
Features image processing and ExtactionFeatures image processing and Extaction
Features image processing and Extaction
Ali A Jalil
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
DEEPASHRI HK
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul Islam
Nazmul Islam
 
IMAGE SEGMENTATION TECHNIQUES
IMAGE SEGMENTATION TECHNIQUESIMAGE SEGMENTATION TECHNIQUES
IMAGE SEGMENTATION TECHNIQUES
Vicky Kumar
 
Image compression models
Image compression modelsImage compression models
Image compression models
priyadharshini murugan
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
lalithambiga kamaraj
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filtering
Gautam Saxena
 
Sharpening spatial filters
Sharpening spatial filtersSharpening spatial filters
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
A B Shinde
 
ImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).pptImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).ppt
VikramBarapatre2
 
IT6005 digital image processing question bank
IT6005   digital image processing question bankIT6005   digital image processing question bank
IT6005 digital image processing question bank
Gayathri Krishnamoorthy
 
Statistical Pattern recognition(1)
Statistical Pattern recognition(1)Statistical Pattern recognition(1)
Statistical Pattern recognition(1)Syed Atif Naseem
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
Krish Everglades
 

What's hot (20)

SPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSINGSPATIAL FILTERING IN IMAGE PROCESSING
SPATIAL FILTERING IN IMAGE PROCESSING
 
Psuedo color
Psuedo colorPsuedo color
Psuedo color
 
Digital Image Processing - Image Compression
Digital Image Processing - Image CompressionDigital Image Processing - Image Compression
Digital Image Processing - Image Compression
 
Pattern Recognition
Pattern RecognitionPattern Recognition
Pattern Recognition
 
Image segmentation
Image segmentationImage segmentation
Image segmentation
 
Chapter 9 morphological image processing
Chapter 9   morphological image processingChapter 9   morphological image processing
Chapter 9 morphological image processing
 
Histogram Equalization
Histogram EqualizationHistogram Equalization
Histogram Equalization
 
Features image processing and Extaction
Features image processing and ExtactionFeatures image processing and Extaction
Features image processing and Extaction
 
Image Enhancement in Spatial Domain
Image Enhancement in Spatial DomainImage Enhancement in Spatial Domain
Image Enhancement in Spatial Domain
 
Hough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul IslamHough Transform By Md.Nazmul Islam
Hough Transform By Md.Nazmul Islam
 
IMAGE SEGMENTATION TECHNIQUES
IMAGE SEGMENTATION TECHNIQUESIMAGE SEGMENTATION TECHNIQUES
IMAGE SEGMENTATION TECHNIQUES
 
Image compression models
Image compression modelsImage compression models
Image compression models
 
Digital Image Processing
Digital Image ProcessingDigital Image Processing
Digital Image Processing
 
Homomorphic filtering
Homomorphic filteringHomomorphic filtering
Homomorphic filtering
 
Sharpening spatial filters
Sharpening spatial filtersSharpening spatial filters
Sharpening spatial filters
 
Image Processing: Spatial filters
Image Processing: Spatial filtersImage Processing: Spatial filters
Image Processing: Spatial filters
 
ImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).pptImageProcessing10-Segmentation(Thresholding) (1).ppt
ImageProcessing10-Segmentation(Thresholding) (1).ppt
 
IT6005 digital image processing question bank
IT6005   digital image processing question bankIT6005   digital image processing question bank
IT6005 digital image processing question bank
 
Statistical Pattern recognition(1)
Statistical Pattern recognition(1)Statistical Pattern recognition(1)
Statistical Pattern recognition(1)
 
Hit and-miss transform
Hit and-miss transformHit and-miss transform
Hit and-miss transform
 

Viewers also liked

Face detection using template matching
Face detection using template matchingFace detection using template matching
Face detection using template matchingBrijesh Borad
 
Face detection ppt by Batyrbek
Face detection ppt by Batyrbek Face detection ppt by Batyrbek
Face detection ppt by Batyrbek Batyrbek Ryskhan
 
Web Services-Enhanced Agile Modeling and Integrating Business Processes
Web Services-Enhanced Agile Modeling and Integrating Business ProcessesWeb Services-Enhanced Agile Modeling and Integrating Business Processes
Web Services-Enhanced Agile Modeling and Integrating Business Processes
Mustafa Salam
 
Template matching
Template matchingTemplate matching
Template matching
Hasan Ijaz
 
Brunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer visionBrunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer visionzukun
 
Modern features-part-4-evaluation
Modern features-part-4-evaluationModern features-part-4-evaluation
Modern features-part-4-evaluationzukun
 
Perceptual image distortion
Perceptual image distortionPerceptual image distortion
Perceptual image distortionPatrick Teo
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-softwarezukun
 
organisation behavior perception distortion
organisation behavior perception distortionorganisation behavior perception distortion
organisation behavior perception distortion
9911755928
 
Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...
Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...
Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...
Gurbinder Gill
 
Machine Learning and Data Mining: 14 Evaluation and Credibility
Machine Learning and Data Mining: 14 Evaluation and CredibilityMachine Learning and Data Mining: 14 Evaluation and Credibility
Machine Learning and Data Mining: 14 Evaluation and Credibility
Pier Luca Lanzi
 
Introduction to Digital Image Correlation (DIC)
Introduction to Digital Image Correlation (DIC)Introduction to Digital Image Correlation (DIC)
Introduction to Digital Image Correlation (DIC)
Instron
 
Digital Image Correlation Presentation
Digital Image Correlation PresentationDigital Image Correlation Presentation
Digital Image Correlation Presentation
trilionqualitysystems
 
Computer vision
Computer visionComputer vision
Computer vision
Kartik Kalpande Patil
 
Speech recognition system seminar
Speech recognition system seminarSpeech recognition system seminar
Speech recognition system seminarDiptimaya Sarangi
 
Speech Recognition Technology
Speech Recognition TechnologySpeech Recognition Technology
Speech Recognition Technology
Seminar Links
 
Speech recognition final presentation
Speech recognition final presentationSpeech recognition final presentation
Speech recognition final presentation
himanshubhatti
 
Correlation coefficient
Correlation coefficientCorrelation coefficient
Correlation coefficientCarlo Magno
 

Viewers also liked (20)

Face detection using template matching
Face detection using template matchingFace detection using template matching
Face detection using template matching
 
Face detection ppt by Batyrbek
Face detection ppt by Batyrbek Face detection ppt by Batyrbek
Face detection ppt by Batyrbek
 
Web Services-Enhanced Agile Modeling and Integrating Business Processes
Web Services-Enhanced Agile Modeling and Integrating Business ProcessesWeb Services-Enhanced Agile Modeling and Integrating Business Processes
Web Services-Enhanced Agile Modeling and Integrating Business Processes
 
Template matching
Template matchingTemplate matching
Template matching
 
Brunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer visionBrunelli 2008: template matching techniques in computer vision
Brunelli 2008: template matching techniques in computer vision
 
Pattern Recognition
Pattern RecognitionPattern Recognition
Pattern Recognition
 
Modern features-part-4-evaluation
Modern features-part-4-evaluationModern features-part-4-evaluation
Modern features-part-4-evaluation
 
Perceptual image distortion
Perceptual image distortionPerceptual image distortion
Perceptual image distortion
 
Modern features-part-3-software
Modern features-part-3-softwareModern features-part-3-software
Modern features-part-3-software
 
organisation behavior perception distortion
organisation behavior perception distortionorganisation behavior perception distortion
organisation behavior perception distortion
 
Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...
Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...
Efficient Variable Size Template Matching Using Fast Normalized Cross Correla...
 
Machine Learning and Data Mining: 14 Evaluation and Credibility
Machine Learning and Data Mining: 14 Evaluation and CredibilityMachine Learning and Data Mining: 14 Evaluation and Credibility
Machine Learning and Data Mining: 14 Evaluation and Credibility
 
Introduction to Digital Image Correlation (DIC)
Introduction to Digital Image Correlation (DIC)Introduction to Digital Image Correlation (DIC)
Introduction to Digital Image Correlation (DIC)
 
Digital Image Correlation Presentation
Digital Image Correlation PresentationDigital Image Correlation Presentation
Digital Image Correlation Presentation
 
Computer vision
Computer visionComputer vision
Computer vision
 
Speech recognition system seminar
Speech recognition system seminarSpeech recognition system seminar
Speech recognition system seminar
 
Speech Recognition Technology
Speech Recognition TechnologySpeech Recognition Technology
Speech Recognition Technology
 
Speech recognition final presentation
Speech recognition final presentationSpeech recognition final presentation
Speech recognition final presentation
 
Research Paper On Correlation
Research Paper On CorrelationResearch Paper On Correlation
Research Paper On Correlation
 
Correlation coefficient
Correlation coefficientCorrelation coefficient
Correlation coefficient
 

Similar to Template Matching - Pattern Recognition

Gavrila_ICCV99.pdf
Gavrila_ICCV99.pdfGavrila_ICCV99.pdf
Gavrila_ICCV99.pdf
Deepdeeper
 
Template Matching
Template MatchingTemplate Matching
Template Matching
SatyamShukla277769
 
Based on correlation coefficient in image matching
Based on correlation coefficient in image matchingBased on correlation coefficient in image matching
Based on correlation coefficient in image matching
IJRES Journal
 
One dimensional vector based pattern
One dimensional vector based patternOne dimensional vector based pattern
One dimensional vector based pattern
ijcsit
 
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGESTEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
IJCI JOURNAL
 
Recovering 3D human body configurations using shape contexts
Recovering 3D human body configurations using shape contextsRecovering 3D human body configurations using shape contexts
Recovering 3D human body configurations using shape contexts
wolf
 
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVALA COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
cscpconf
 
A comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrievalA comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrieval
csandit
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)IJERD Editor
 
A04570106
A04570106A04570106
A04570106
IOSR-JEN
 
Recognition as Graph Matching
  Recognition as Graph Matching  Recognition as Graph Matching
Recognition as Graph Matching
Vishakha Agarwal
 
Object Elimination and Reconstruction Using an Effective Inpainting Method
Object Elimination and Reconstruction Using an Effective Inpainting MethodObject Elimination and Reconstruction Using an Effective Inpainting Method
Object Elimination and Reconstruction Using an Effective Inpainting Method
IOSR Journals
 
Mscs discussion
Mscs discussionMscs discussion
Mscs discussion
Crizalde Malaque
 
Exploiting Dissimilarity Representations for Person Re-Identification
Exploiting Dissimilarity Representations for Person Re-IdentificationExploiting Dissimilarity Representations for Person Re-Identification
Exploiting Dissimilarity Representations for Person Re-Identification
Riccardo Satta
 
Learning from similarity and information extraction from structured documents...
Learning from similarity and information extraction from structured documents...Learning from similarity and information extraction from structured documents...
Learning from similarity and information extraction from structured documents...
Infrrd
 
Surface Data Capture Image Matching
Surface Data Capture Image MatchingSurface Data Capture Image Matching
Surface Data Capture Image MatchingRASHID JAVED
 
clinic_poster_final_3
clinic_poster_final_3clinic_poster_final_3
clinic_poster_final_3Danny Taller
 
A Mat Lab built software application for similar image retrieval
A Mat Lab built software application for similar image retrievalA Mat Lab built software application for similar image retrieval
A Mat Lab built software application for similar image retrieval
IOSR Journals
 

Similar to Template Matching - Pattern Recognition (20)

Gavrila_ICCV99.pdf
Gavrila_ICCV99.pdfGavrila_ICCV99.pdf
Gavrila_ICCV99.pdf
 
Template Matching
Template MatchingTemplate Matching
Template Matching
 
Based on correlation coefficient in image matching
Based on correlation coefficient in image matchingBased on correlation coefficient in image matching
Based on correlation coefficient in image matching
 
One dimensional vector based pattern
One dimensional vector based patternOne dimensional vector based pattern
One dimensional vector based pattern
 
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGESTEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
TEMPLATE MATCHING TECHNIQUE FOR SEARCHING WORDS IN DOCUMENT IMAGES
 
Pca analysis
Pca analysisPca analysis
Pca analysis
 
Recovering 3D human body configurations using shape contexts
Recovering 3D human body configurations using shape contextsRecovering 3D human body configurations using shape contexts
Recovering 3D human body configurations using shape contexts
 
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVALA COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
A COMPARATIVE ANALYSIS OF RETRIEVAL TECHNIQUES IN CONTENT BASED IMAGE RETRIEVAL
 
A comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrievalA comparative analysis of retrieval techniques in content based image retrieval
A comparative analysis of retrieval techniques in content based image retrieval
 
20151130
2015113020151130
20151130
 
International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)International Journal of Engineering Research and Development (IJERD)
International Journal of Engineering Research and Development (IJERD)
 
A04570106
A04570106A04570106
A04570106
 
Recognition as Graph Matching
  Recognition as Graph Matching  Recognition as Graph Matching
Recognition as Graph Matching
 
Object Elimination and Reconstruction Using an Effective Inpainting Method
Object Elimination and Reconstruction Using an Effective Inpainting MethodObject Elimination and Reconstruction Using an Effective Inpainting Method
Object Elimination and Reconstruction Using an Effective Inpainting Method
 
Mscs discussion
Mscs discussionMscs discussion
Mscs discussion
 
Exploiting Dissimilarity Representations for Person Re-Identification
Exploiting Dissimilarity Representations for Person Re-IdentificationExploiting Dissimilarity Representations for Person Re-Identification
Exploiting Dissimilarity Representations for Person Re-Identification
 
Learning from similarity and information extraction from structured documents...
Learning from similarity and information extraction from structured documents...Learning from similarity and information extraction from structured documents...
Learning from similarity and information extraction from structured documents...
 
Surface Data Capture Image Matching
Surface Data Capture Image MatchingSurface Data Capture Image Matching
Surface Data Capture Image Matching
 
clinic_poster_final_3
clinic_poster_final_3clinic_poster_final_3
clinic_poster_final_3
 
A Mat Lab built software application for similar image retrieval
A Mat Lab built software application for similar image retrievalA Mat Lab built software application for similar image retrieval
A Mat Lab built software application for similar image retrieval
 

More from Mustafa Salam

Switch-based Interconnection Networks 2
Switch-based Interconnection Networks 2Switch-based Interconnection Networks 2
Switch-based Interconnection Networks 2
Mustafa Salam
 
Interconnection Networks 1
Interconnection Networks 1Interconnection Networks 1
Interconnection Networks 1
Mustafa Salam
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
Mustafa Salam
 
Arabic Handwritten Text Recognition and Writer Identification
Arabic Handwritten Text Recognition and Writer IdentificationArabic Handwritten Text Recognition and Writer Identification
Arabic Handwritten Text Recognition and Writer Identification
Mustafa Salam
 
The Burrows-Wheeler Algorithm
The Burrows-Wheeler AlgorithmThe Burrows-Wheeler Algorithm
The Burrows-Wheeler Algorithm
Mustafa Salam
 
Link analysis .. Data Mining
Link analysis .. Data MiningLink analysis .. Data Mining
Link analysis .. Data Mining
Mustafa Salam
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategy
Mustafa Salam
 
Cuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly AlgorithmsCuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly Algorithms
Mustafa Salam
 
Cloud technology (Mashup) + Case Study
Cloud technology (Mashup) + Case StudyCloud technology (Mashup) + Case Study
Cloud technology (Mashup) + Case Study
Mustafa Salam
 
Color Models
Color ModelsColor Models
Color Models
Mustafa Salam
 

More from Mustafa Salam (10)

Switch-based Interconnection Networks 2
Switch-based Interconnection Networks 2Switch-based Interconnection Networks 2
Switch-based Interconnection Networks 2
 
Interconnection Networks 1
Interconnection Networks 1Interconnection Networks 1
Interconnection Networks 1
 
Parallel Processing
Parallel ProcessingParallel Processing
Parallel Processing
 
Arabic Handwritten Text Recognition and Writer Identification
Arabic Handwritten Text Recognition and Writer IdentificationArabic Handwritten Text Recognition and Writer Identification
Arabic Handwritten Text Recognition and Writer Identification
 
The Burrows-Wheeler Algorithm
The Burrows-Wheeler AlgorithmThe Burrows-Wheeler Algorithm
The Burrows-Wheeler Algorithm
 
Link analysis .. Data Mining
Link analysis .. Data MiningLink analysis .. Data Mining
Link analysis .. Data Mining
 
IP Addressing & subnetting strategy
IP Addressing & subnetting strategyIP Addressing & subnetting strategy
IP Addressing & subnetting strategy
 
Cuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly AlgorithmsCuckoo Search & Firefly Algorithms
Cuckoo Search & Firefly Algorithms
 
Cloud technology (Mashup) + Case Study
Cloud technology (Mashup) + Case StudyCloud technology (Mashup) + Case Study
Cloud technology (Mashup) + Case Study
 
Color Models
Color ModelsColor Models
Color Models
 

Recently uploaded

Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
Vivekanand Anglo Vedic Academy
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
EugeneSaldivar
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
EduSkills OECD
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 

Recently uploaded (20)

Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
Sectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdfSectors of the Indian Economy - Class 10 Study Notes pdf
Sectors of the Indian Economy - Class 10 Study Notes pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...TESDA TM1 REVIEWER  FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
TESDA TM1 REVIEWER FOR NATIONAL ASSESSMENT WRITTEN AND ORAL QUESTIONS WITH A...
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptxStudents, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
Students, digital devices and success - Andreas Schleicher - 27 May 2024..pptx
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 

Template Matching - Pattern Recognition

  • 1.
  • 2. 1. INTRODUCTION Template matching is a technique in computer vision used for finding a sub-image of a target image which matches a template image. This technique is widely used in object detection fields such as vehicle tracking, robotics , medical imaging, and manufacturing . The crucial point is to adopt an appropriate “measure” to quantify similarity or matching. However, this method also requires extensive computational cost since the matching process involves moving the template image to all possible positions in a larger target image and computing a numerical index that indicates how well the template matches the image in that position. This problem is thus considered as an optimization problem. A reasonable first step to approaching such a task is to define a measure or a cost measuring the“distance”or the“similarity”between the (known) reference patterns and the (unknown) test pattern, in order to perform the matching operation known as template matching. Pattern Recognition – TM Page | 2
  • 3. 2. Template Matching Types Template matching has been performed at the pixel level and also on higher level. A. Pixel Level Template Matching: Pixel templates come in four types: a) Total templates: Template is the same size as the input image. There is no rotation or translation invariance. b) Partial templates: Template is free from the background. Multiple matches are allowed. Partial matches may also be allowed. Care must be taken in this case -- an F template could easily match to an E. Template Image Pattern Recognition – TM Page | 3
  • 4. c) Piece templates : Templates that match one feature of a figure. These templates break a pattern into its component segments so, for example, "A" can be broken down into "/", "" and "-". The order in which templates are compared to the scene is important: the largest templates must be tried first, since they contain the most information and may subsume smaller templates. d) Flexible templates: These templates can handle stretching, misorientation and other possible deviations. A good prototype of a known object is first obtained and represented parametrically. Pattern Recognition – TM Page | 4
  • 5. B. High Level Template Matching A problem with pixel based is that although fairly cheap and simple to implement; rotation and translation is a problem, also images are rarely perfect suffering from blurring, stretched and other distortions and peppered with noise. High level template matching methods operate on an image that has typically been segmented into regions of interest. Regions can be described in terms of area, average intensity, rate of change of intensity, curvature and also compared -- bigger than, adjacent to, above, distance between. Templates are described in relationships between regions. Production rules and other linguistic representations have been used. Also statistical methods (relaxation based techniques) have been applied to perform the matching. a) Feature-based Matching: When the template image has strong features, a feature-based approach may be considered; the approach may prove further useful if the match in the search image might be transformed in some fashion. Since this approach does not consider the entirety of the template image, it can be more computationally efficient when working with source images of larger resolution. Pattern Recognition – TM Page | 5
  • 6. b) Template-based Matching: For templates without strong features, or for when the bulk of the template image constitutes the matching image, a template-based approach may be effective. Template-based template matching may potentially require sampling of a large number of points, it is possible to reduce the number of sampling points by reducing the resolution of the search and template images by the same factor and performing the operation on the resultant downsized images (multi-resolution, or pyramid, image processing).  Image Pyramid Image Pyramid is a series of images, each image being a result of downsampling (scaling down, by the factor of two in this case) of the previous element.  Pyramid Processing  At each level of the pyramid, we will need appropriately downsampled picture of the reference template, i.e. both input image pyramid and template image pyramid (Pyramid Processing) should be computed. Pattern Recognition – TM Page | 6
  • 7.  Grayscale-based Matching Although in some of the applications the orientation of the objects is uniform and fixed (as we have seen in the plug example), it is often the case that the objects that are to be detected appear rotated. In Template Matching algorithms the classic pyramid search is adapted to allow multi-angle matching, i.e. identification of rotated instances of the template. This is achieved by computing not just one template image pyramid, but a set of pyramids - one for each possible rotation of the template. During the pyramid search on the input image the algorithm identifies the pairs (template position, template orientation) rather than sole template positions. Similarly to the original schema, on each level of the search the algorithm verifies only those (position, orientation)pairs that scored well on the previous level (i.e. seemed to match the template in the image of lower resolution). The technique of pyramid matching together with multi-angle search constitute the Grayscale-based Template Matching method. Pattern Recognition – TM Page | 7
  • 8.  Edge-based Matching Edge-based Matching enhances the previously discussed Grayscale-based Matching using one crucial observation - that the shape of any object is defined mainly by the shape of its edges. Therefore, instead of matching of the whole template, we could extract its edges and match only the nearby pixels, thus avoiding some unnecessary computations. In common applications the achieved speed-up is usually significant. 3. Template Matching Measures Measure of match between two images is considered to be a metric that indicate the degree of similarity or dissimilarity between them. Unless it is specifically stated otherwise, this metric can be increasing or decreasing with degree of similarity. Where the metric is specifically stated to be a measure of mismatch, it is a quantity that is increasing with the degree of dissimilarity. Pattern Recognition – TM Page | 8
  • 9. 3.1 Measures of Match (similarity) 1) MEASURES BASED ON OPTIMAL PATH SEARCHING TECHNIQUES Representation: Represent the template by a sequence of measurement vectors. Template: Test pattern: r(1), r(2),..., r(I ) t(1), t(2),..., t(J ) I  J  Form a grid with I points (template) in horizontal and J points (test) in vertical  Each point (i,j) of the grid measures the distance between r(i) and t(j)  Path: A path through the grid, from an initial node (i0, j0) to a final one (if, jf), is an ordered set of nodes (i0, j0), (i1, j1), (i2, j2) … (ik, jk) … (if, jf)  Each path is associated with a cost K  1  k k D d( i , j ) k  0  Where K is the number of nodes across the path Pattern Recognition – TM Page | 9
  • 10. The optimal path (blue) is constructed by searching among all allowable paths. The optimal node correspondence, between the test and reference patterns, is unraveled by backtracking the optimal path. 2) Euclidean Distance Let I be a gray level image and g be a gray-value template of size n X m. In this formula (r,c) denotes the top left corner of template g. 3) The Edit Distance Deals with patterns that consist of sets of ordered symbols. For example,if these symbols are letters,then the patterns are words from a written text. Such problems arise in automatic editing and text retrieval applications. Other examples of symbol strings occur in structural pattern recognition. Once the symbols of a (test) pattern have been identified, for example, via a reading device, the task is to recognize the pattern, searching for the best match of it against a set of reference patterns. Pattern Recognition – TM Page | 10
  • 11. ■ Wrongly identified symbol (e.g.,“befuty” instead of “beauty”) ■ Insertion error (e.g.,“bearuty”) ■ Deletion error (e.g.,“beuty”) The similarity between two patterns is based on the “cost” associated with converting one pattern to the other. If the patterns are of the same length, then the cost is directly related to the number of symbols that have to be changed in one of them so that the other pattern results. The Edit distance between two string patterns A and B, denoted D(A, B), is defined as the minimum total number of changes C, insertions I ,and deletions R required to change pattern A into pattern B, D(A,B)  min[C( j)  I ( j)  R( j)] j Where j runs over all possible variations of symbols, in order to convert A B. Computation of the Edit distance with (a) an insertion, (b) a change, (c) a deletion, and (d) an equality. Pattern Recognition – TM Page | 11
  • 12.  Allowable predecessors and costs 1. Diagonal transitions: t i r j 0, if ( ) ( )    t i r j 1, ( )  ( )  d i j i j ( , 1, 1)    2. Horizontal and vertical transitions: d(i, j i 1, j) 1 d(i, j i, j 1) 1 4) MEASURES BASED ON CORRELATIONS The major task here is to find whether a specific known reference pattern resides within a given block of data. Such problems arise in problems such as target detection, robot vision, video coding. There are two basic steps in such a procedure:  Step 1: Move the reference pattern to all possible positions within the block of data. For each position, compute the “similarity” between the reference pattern and the respective part of the block of data. Pattern Recognition – TM Page | 12
  • 13.  Step 2: Compute the best matching value.   N i i   x x y y ( )       1 1 N i 2 2 1 0 N      x  x  y  y i i   0 0 i i cor   x  x  y  y x is the template gray level image 2 2       i i Pattern Recognition – TM Page | 13           1 0 1 0 1 0 ) ( N i N i i N i i y y x x is the average grey level in the template image y is the source image section y is the average grey level in the source image N is the number of pixels in the section image (N= template image size = columns * rows) The value cor is between –1 and +1, with larger values representing a stronger relationship between the two images.
  • 14. 3.2 Measures of Mismatch (dissimilarity) These measures of match are based on the pixel-by-pixel intensity differences between the two images f and g. 1) Root mean square distance (RMS): The RMS distance metric is a common measure of mismatch between two digital images. It is given by: 2) Sum of absolute differences (SAD): compare the intensities of the pixels to handle translation problems on images, using template matching. A pixel in the search image with coordinates (xs, ys) has intensity Is(xs, ys) and a pixel in the template with coordinates (xt, yt) has intensity It(xt, yt ). Thus the absolute difference in the pixel intensities is defined as Diff(xs, ys, x t, y t) = | Is(xs, ys) – It(x t, y t) |. Pattern Recognition – TM Page | 14
  • 15. 4. Problems with template matching 1) The template represents the object as we expect to find it in the image 2) The object can indeed be scaled or rotated 3) This technique requires a separate template for each scale and orientation 4) Template matching become thus too expensive, especially for large templates 5) Sensitive to: –noise –occlusions Pattern Recognition – TM Page | 15
  • 16. 5. Template Matching Applications: 1) Template matching with various average face pyramid levels. 2) 3D reconstruction. 3) Motion detection. 4) Object recognition. 5) Panorama reconstruction. Pattern Recognition – TM Page | 16
  • 17. Reference: 1. G.s.cox,1995. “ template matching and measures of match in image processing”,July 12 . cape town university. 2. https://www.adaptivevision.com/pl/dane_techniczne/dokumentacja /3.2/machine_vision_guide/TemplateMatching.html 3. http://numerics.mathdotnet.com/docs/Distance.html 4. http://www-cs-students. stanford.edu/~pdoyle/quail/notes/pdoyle/vision.html#Te mplate Matching 5. http://en.wikipedia.org/wiki/Template_matching 6. http://www.lira.dist.unige.it/teaching/SINA/slides-current/interest-points. pdf 7. OpenCV 2.4.5.0 documentation.htm 8. Jain. D, Tolga. H, and Meiyappan. S, “Face Detection using Template Matching”, , EE 368 – Digital Image Processing, Spring 2002-2003. Pattern Recognition – TM Page | 17