Template matching algorithms

erjik picture erjik · Jul 6, 2010 · Viewed 7.9k times · Source

Please suggest any template matching algorithms, which are independent of size and rotation. (any source codes as examples if possible please)

EDIT 1: Actually I understand how the algorithm works, we can resize template and rotate it. It is computationally expensive, but we can use image pyramids. But the real problem for me now is when the picture is made at some angle to object, so that only a perspective transform can correct the image. I mean that even if we rotate image or scale it, we will not get a good match if the object in image is perspectively transformed. Of course it is possible to try to generate many templates at different perspective, but I think it is very bad idea.

EDIT 2: One more problem when using template matching based on shape matching. What if image doesn't have many sharp edges? For example a plate or dish?

EDIT 3: I've also heard about camera callibration for object detection. What is the algorithm used for that purpose? I don't understand how it can be used for template matching.

Answer

carlosdc picture carlosdc · Jul 9, 2010

I don't think there is an efficient template matching algorithm that is affine-invariant (rotation+scale+translation).

You can make template matching somewhat robust to scale+rotation by using a distance transform (see Chamfering style methods). You should probably also look at SIFT and MSER to get a sense of how the research area has been shaped the past decade. But these are not template matching algorithms.