What is the difference between phase correlation and template matching in OpenCV?
Asked Answered
M

1

7

I recently discovered phase correlation in OpenCV, which with the Log Polar Transform (LPT) can perform rotation and scale invariant template matching. I'm wondering what the difference is between this method and all the template matching methods described here http://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html which seem far less robust to any rotation or scaling.

I guess my question is what are the advantages and disadvantages of:

  1. Phase correlation + Log polar transform.
  2. Template matching .
  3. Full flown features matching with something like SIFT.
Mort answered 10/5, 2016 at 16:18 Comment(0)
S
9

Phase correlation and log-polar transform are implemented in the frequency domain, both these algorithms are derived from the Fourier shift theorem that two translated images will show similar phase differences in the frequency domain. Phase correlation is able to register only translation motion whereas the log-polar transform works in the log-polar domain which essentially converts rotation and scale changes into linear translation. So using log-polar matching you can register two images that are scaled rotated and translated copies of each other. Both of these algorithms cannot register deformable transformation. For detailed analysis regarding ambiguity and range of rotation and scale variation these algorithms can determine, you can refer to this paper "http://ieeexplore.ieee.org/document/901003/".

Template matching is essentially finding a known template's presence in a base image using varied similarity metrics(Sum of squared differences, normalized cross-correlation, Hausdorff distance, etc). So the match can be applied on either spatial attribute( intensity image, edge map, HOG) or frequency attribute(phase). Phase correlation and log-polar matching can be implemented on same size images so phase-based template matching will essentially correspond to finding the same patch in the search space with the highest value of correlation.

SIFT, SURF, etc generate a large feature vector set dependent on various parameters such that it is unaffected by scale variation, noise, and illumination changes. This is a very wide topic and many papers are available online comparing their functioning.

According to my experience SIFT, SURF is a much more robust classifier in localizing the object in a single frame but if you are planning to locate an object in a video where computational time is a limiting factor then template matching serves better.

Sudderth answered 9/10, 2016 at 7:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.