Ask Your Question

gpu::matchTemplate versus cvMatchTemplate

asked 2014-10-19 16:52:55 -0600

cesare90 gravatar image

updated 2014-10-19 17:22:17 -0600

I've implemented a software for searching a pattern inside an image. With cvMatchTemplate the execution time is around 10ms (because I'm taking a pattern of 40x40 in a search window of 120x160 pixels. The image is 640x480 so I'm not considering the whole image).

I've implemented the same algorithm by using the gpu::MatchTemplate, and I was expecting improvements for the execution time. It is taking 220ms to compute the score. (The method is CV_TM_CCOEFF_NORMED).

What is happening?


edit retag flag offensive close merge delete



Have you measured the time to send the image to the GPU and load the result? For short tasks, this overhead could slow down your execution.

FooBar gravatar imageFooBar ( 2014-10-20 01:49:09 -0600 )edit

Yes the time is 1 ms for loading the images (they are uncompressed already and i measured on the ".upload" function). The problem is that the same function on the CPU is faster. Is there any FFT performed, or is it used a different algorithm? Is there a way to change the source code?

cesare90 gravatar imagecesare90 ( 2014-10-20 09:50:25 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-10-25 02:54:29 -0600

cesare90 gravatar image

Does anyone have any idea? Is there a malloc allocation inside the library that drains time?


edit flag offensive delete link more

Question Tools


Asked: 2014-10-19 16:52:55 -0600

Seen: 291 times

Last updated: Oct 25 '14