Ask Your Question
0

Featuretracker: OpenCV has been compiled without SIFT support

asked 2013-08-26 08:47:52 -0600

todor gravatar image

Hi,

I tried runnign the "hybridtrackingsample" example (from the contrib module) and got an "OpenCV has been compiled without SIFT support" exception. I looked trough the "featuretracker.cpp" file and added #include "opencv2/nonfree/nonfree.hpp" and initModule_nonfree(); , however that just gives me another error: libopencv_contrib.so.2.4.6: undefined reference to `cv::initModule_nonfree()'. I think it has something to do with the order in which the modules are compiled or linked, but I'm new to C++ so I got stuck at this point.

Here is the full error message i get when running cpp-example-hybridtracker: "OpenCV Error: The function/feature is not implemented (OpenCV has been compiled without SIFT support) in CvFeatureTracker, file /opt/opencv-2.4.6.1/modules/contrib/src/featuretracker.cpp, line 58 terminate called after throwing an instance of 'cv::Exception' what(): /opt/opencv-2.4.6.1/modules/contrib/src/featuretracker.cpp:58: error: (-213) OpenCV has been compiled without SIFT support in function CvFeatureTracker"

Hot to reproduce:

Build opencv >= 2.4, make sure to also build the examples. Run the cpp-example-hybridtrackingsample with the live parameter.

Any ideas on how I could get the featuretracker to work ?

edit retag flag offensive close merge delete

Comments

1

You have to compile or get a compiled version of opencv which includes the nonfree module.

Rui Marques gravatar imageRui Marques ( 2013-08-26 09:56:17 -0600 )edit

I've built opencv from source. I used cmake-gui and made sure the BUILD_opencv_nonfree is ticked. I can use surf and sift after building the project. The order in which it builds the modules might be wrong, but since I don't know much c/c++ i got stuck there.

todor gravatar imagetodor ( 2013-08-26 10:10:21 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-08-29 08:07:25 -0600

todor gravatar image

updated 2013-08-29 08:07:45 -0600

Ok, so I found the solution

Step1: the CMakeLists.txt in the contrib module is missing the opencv_nonfree module, just add that entry there.

Step2: the FeatureTracker.cpp has a bug in it and is missing two break; statements, more on this here: http://stackoverflow.com/questions/13079098/opencv-error-at-hybridtrackingsample-cpp-sample

edit flag offensive delete link more

Comments

Actually, the featuretracker bug has already been fixed. If you use OpenCV 2.4.6, then the fix should be included, just checked the latest 2.4 branch on github. Using older versions always comes with risks! I submitted a pull request for the cmakelists.txt, will see if developers agree on this.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-29 09:09:25 -0600 )edit

https://github.com/Itseez/opencv/pull/1369 will keep you updated of the result :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-08-29 09:12:58 -0600 )edit

I have the same problem with OpenCV 2.4.6 (I downloaded from git and sourceforge, no difference!). It seems that they changed CMakeLists.txt in the version 2.4.6 because I cannot locate contrib module to add opencv_nonfree module. Any idea how to fix this problem?

Rasoul gravatar imageRasoul ( 2013-10-15 14:35:35 -0600 )edit

@Rasoul, if you would have checked my pull request, you would have seen the solution. It is submitted as a pull request to the source code, however, opencv developers are not convinced this is the most clean way to do so. I guess we have to wait until they merge the request!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-10-16 01:36:40 -0600 )edit

Fix is merged!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-10-17 06:46:21 -0600 )edit
1

answered 2014-05-15 08:41:01 -0600

Y Simson gravatar image

This worked for me on version 2.4.9. I had the exact same problem trying to run the hybridtracking example

Goto opencv_contrib module->$(OPENCV_DIR)\sources\modules\contrib\src\featuretracker.cpp

Replace these lines:

#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"

static bool makeUseOfNonfree = initModule_nonfree();
#endif

With the following:

#define HAVE_OPENCV_NONFREE
#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"

static bool makeUseOfNonfree = cv::initModule_nonfree();
#endif
edit flag offensive delete link more

Comments

... though that define probably should not go into the src code, but into the makefile/project

berak gravatar imageberak ( 2014-05-15 09:02:11 -0600 )edit

Question Tools

Stats

Asked: 2013-08-26 08:47:52 -0600

Seen: 4,389 times

Last updated: May 15 '14