Python Feature Matching Speed

asked 2014-05-10 22:43:12 -0600

Christopher gravatar image

I'm looking to find which object from a large database of images (I'll precompute and store the feature descriptions) in a video feed in realtime. I see people pulling this off in C++, like the following video I found:

But my speeds in Python are way too high. I'm seeing 300-1k ms depending on the detection method with FLANN for __ONE__ object, trying all of the feature matching sample code that came with the OpenCV source. Is this just the way of things? Might I have done something wrong when compiling OpenCV?

Basically, are the speeds like in the video attainable in Python or do I need to go learn C++ to actually make my project work? Would love any ideas what I might be doing wrong if I am the problem. :)

edit retag flag offensive close merge delete


I'm getting these results with 2.4.8, 2.4.9, and 3.0.

Christopher gravatar imageChristopher ( 2014-05-10 22:49:48 -0600 )edit

Usually python is indeed a lot slower, but in opencv python just wraps around the c/c++ code of opencv. So running the opencv operations shouldnt be slower at all. You dont know exactly what the guy in the video did. Maybe he also used the CUDA surf implementation of opencv to reach less computation time. Anyways, you can of course try your simple example in c++. It shouldnt be that hard, since the tutorials almost contain everything you need already.

Moster gravatar imageMoster ( 2014-05-11 01:52:29 -0600 )edit

CUDA may well be it. I've become aware of that since reading more... unfortunately it is not available in the Python wrapper. :(

I'll be trying the C++ samples and what kind of times I get.

Christopher gravatar imageChristopher ( 2014-05-11 07:52:59 -0600 )edit