cvMatchTemplate algorithm and speed

asked 2017-08-03 13:41:37 -0600

Alopex gravatar image

updated 2020-11-02 17:37:38 -0600

This is a continuation of an older post: http://answers.opencv.org/question/83...

Basically, what I want to know is:

1) What is up with the official documentation ( http://docs.opencv.org/2.4/doc/tutori... ) saying that the method involves a raster scan pixel by pixel through an image and storing the coordinates? When this is implemented for a decent size file, a 100x100 pixel scan = 10,000 movements of an image matrix and then the resultant scores. When I've tried this method, it results in match times in excess of 5 minutes per image.

2) The official documentation does not mention DFT/FFT at all but Tetragramm (on this site) provided a helpful response. I'd like more clarity on this, though: what is the actual algorithm used? The code is dense when I've looked in the .cpp source files. The source and template images are Fourier transformed, and then somehow they are realigned to determine the geometric transformation?

Thanks for the help - I'm just trying to understand how this all works.

edit retag flag offensive close merge delete

Comments

The official documentation does not mention DFT/FFT at all yes but official documentaton is not a mathematic lecture see Fourier and FFT and then cross-correlation

LBerger gravatar imageLBerger ( 2017-08-03 13:55:23 -0600 )edit

are you aware , that this is a c-api function (the whole lot of of it died, way back in 2010)

seriously, you have a documetation problem , here.

berak gravatar imageberak ( 2017-08-03 14:02:57 -0600 )edit

Apparently that's all there is to it. I guess I was less looking for a math lecture and more puzzled why the description of the algorithm in the documentation doesn't match what the code is actually doing. Thank you for the responses.

Alopex gravatar imageAlopex ( 2017-08-03 14:16:35 -0600 )edit

you should read this too and you are welcome to improve doc and source code

LBerger gravatar imageLBerger ( 2017-08-04 02:09:04 -0600 )edit