[kinovea-dev] OpenCV performances

  • From: <joan@xxxxxxxxxxx>
  • To: <kinovea-dev@xxxxxxxxxxxxx>
  • Date: Thu, 04 Mar 2010 14:34:42 +0100


Wow.

I just took some time today to write benchmarking code and well, I
wasn't expecting that much performance increase.

Some weeks ago I have
switched the similarity measure of the tracking tool from sum of absolute
difference (AForge template matching) to Normalized cross correlation (as
per the litterature it seem to be one of the best measure for template
matching).

I had spend quite some time to optimise my Normalized cross
correlation code to be able to match the original speed. (because obviously
there are much more operations involved when performing a normalized cross
correlation than when doing the simple sum of differences between each
pixel.)

And today I benchmarked OpenCV normalized cross correlation
(through EmguCV) against both. Here are some typical results, template was
20×20, search zone 100×100, and ran on 25 images in a loop :

- Sum of
absolute difference (AForge): 3129 ms.
- Normalized cross correlation
(joan): 2178 ms.
- Sum of squared difference (OpenCV): 237 ms.
- Normalized
cross correlation (OpenCV): 238 ms.

Yes, that's roughly 10 times faster.
Resulting matches are the same. 

What does this mean ?
Well, it means
we'll be able to do multiple point tracking in real time AND use bigger
search windows at the same time ! Awesome :-)

Caveat: Now that I've seen
this I can't go back. This performance increase HAS to be included in the
next official release :-) 

joan.

Other related posts:

  • » [kinovea-dev] OpenCV performances - joan