Search code examples
objective-copencvobjective-c++surf

CVSurf (OpenCV) feature in iOS


I've an issue with OpenCV and iOS. I tried to implement SURF in my Xcode project but when I try to execute it, this error message appears:

OpenCV Error: The function/feature is not implemented (OpenCV was built without SURF support) in cvExtractSURF, file /Users/alexandershishkov/opencv2.4.3rc/opencv/modules/legacy/src/features2d.cpp, line 77 libc++abi.dylib: terminate called throwing an exception

I had compiled OpenCV from the official repository on Github and with this tutorial: http://docs.opencv.org/trunk/doc/tutorials/introduction/ios_install/ios_install.html#ios-installation

Maybe you have an idea... I'm lost.

Thank you.


Solution

  • You need to read my self-answered question here:

    openCV 2.4.3 iOS framework compiler trouble recognising some c++ headers

    The bit that is catching you out is probably that SURF has been moved to non-free (as it has licensing issues). So you need to:

    #include <opencv2/nonfree/nonfree.hpp>
    #include <opencv2/legacy/compat.hpp>
    

    and possibly

     cv::initModule_nonfree();
    

    if you are working with older the C interface

    There are alternatives to SURF if you wish to stick with the open-licensed standard openCV library...