OpenCV SURF function is not implemented

前端 未结 4 608
予麋鹿
予麋鹿 2020-12-01 09:48

When I try to run the sample find_obj.cpp or any OpenCV SURF program I get the following error in command prompt while executing the code. The project builds wi

相关标签:
4条回答
  • 2020-12-01 10:22

    Taken from this answer (why don't you google your question before asking?):

    The SIFT and SURF code was moved in OpenCV v2.4 to a new module called nonfree. Make sure you are linking (DLL in Windlows) to it. In linux this library is called libopencv_nonfree.so.

    0 讨论(0)
  • 2020-12-01 10:28

    For ubuntu the script at https://help.ubuntu.com/community/OpenCV can be modified for nonfree surf/sift use by adding

    libopencv_nonfree

    to the end of the sudo apt-get command, and

    -D BUILD_opencv_nonfree=ON

    to the end of the cmake command. It only worked for me after uninstalling everything I could find dealing with opencv from the software center. Incidentally the software center also had an opencv nonfree library, "libopencv-nonfree2.4" which didn't seem to help matters. I am not an expert in such stuff so I don't know if what I did is 100% right, but it allows commands such as

    surf = cv2.SURF(400)

    and

    keypoints = surfDetector.detect(im)

    to run which hadnt previously (the first caused a 'not found' type error while the second caused a segfault).

    The version of opencv.sh which allowed me to use nonfree surf/sift pasted to http://pastebin.com/sQzDdx5i
    The version that is working now is opencv-2.4.9 but possibly this would work for other versions as the script seems to be somewhat agnostic as do the lib names.

    0 讨论(0)
  • 2020-12-01 10:43

    It's not a bug. SURF is located in nonfree module. To use it you should initialize nonfree module:

        #include <opencv2/nonfree/nonfree.hpp> 
        ... 
        cv::initModule_nonfree();
    
    0 讨论(0)
  • 2020-12-01 10:44

    Recently, I am learning the SURF. For this question you can add the opencv_nonfree240d.lib and opencv_nonfree240.lib to your project's lib path.

    0 讨论(0)
提交回复
热议问题