OpenCV SURF function is not implemented
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
.
OpenCV xfeatures2d_SURF -213:The function/feature is not implemented
As discussed in the comments, you can no longer get the non-free modules via pip
. The PyPI package opencv-python-contrib
used to "erroneously" contain the non-free packages such as SIFT. This was "fixed" recently, so they no longer install with newer versions of opencv-python-contrib
. From the GitHub issue tracker for the PyPI package:
Those algorithms have been included erroneously before because they
were not properly protected in the upstream by the
OPENCV_ENABLE_NONFREE flag.I am not a lawyer. I'm not sure if I can redistribute those
algorithms.Edit: See:
opencv/opencv_contrib#1668
SURF not bound in opencv-python?
It seems that some functions are moved to "nonfree" module and that module is removed from the latest OpenCV package on FC18. Until this will be resolved, I made downgrade OpenCV library on my 64bit FC18 from version 2.4.3 to version 2.3.1. With downgraded library, all my python code started to work as it worked on FC17. Here is link to my post where I have described complete "downgrade" procedure:
http://www.redips.net/linux/downgrade-opencv-fedora18/
Can't use SURF, SIFT in OpenCV
I think this is far from the "correct" way to do it (the "correct" way on Ubuntu seems to be to stick to a broken and/or outdated OpenCV), but for me building opencv-2.4.6.1 from source brings back cv2.SIFT and cv2.SURF.
Steps:
- Download opencv-2.4.6.1.tar.gz from opencv.org.
Extract the source:
tar -xf opencv-2.4.6.1.tar.gz -C /tmp
Configure the source. This will tell OpenCV to install into .opencv-2.4.6.1 in your home directory:
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D BUILD_PYTHON_SUPPORT=ON \
-D WITH_XINE=ON \
-D WITH_OPENGL=ON \
-D WITH_TBB=ON \
-D BUILD_EXAMPLES=ON \
-D BUILD_NEW_PYTHON_SUPPORT=ON \
-D WITH_V4L=ON \
-D CMAKE_INSTALL_PREFIX=~/.opencv-2.4.6.1 \
/tmp/opencv-2.4.6.1Build and install:
cd /tmp/opencv-2.4.6.1
make -j4
make installSet PYTHONPATH (this works in bash, I have no clue about other shells):
export PYTHONPATH=~/.opencv-2.4.6.1/lib/python2.7/dist-packages
Now if I start python and import cv2 (for me, this produces a gnome-keyring warning), I have cv2.SIFT and cv2.SURF available.
SURF and SIFT algorithms doesn't work in OpenCV 3.0 Java
If you compile OpenCV from source, you can fix the missing bindings by editing opencv/modules/features2d/misc/java/src/cpp/features2d_manual.hpp yourself.
I fixed it by making the following changes:
(line 6)
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include "features2d_converters.hpp"
...(line 121)
case SIFT:
fd = xfeatures2d::SIFT::create();
break;
case SURF:
fd = xfeatures2d::SURF::create();
break;
...(line 353)
case SIFT:
de = xfeatures2d::SIFT::create();
break;
case SURF:
de = xfeatures2d::SURF::create();
break;
The only requirement is that you build opencv_contrib optional module along with your sources (you can download the git project from https://github.com/Itseez/opencv_contrib and just set its local path on opencv's ccmake settings.
Oh, and keep in mind that SIFT and SURF are non-free software ^^;
Error cv::SURF::SURF(double,int,int,bool,bool) in Implementation SURF with OpenCV and C++
Try to add those libs if you are in Debug mode and using OpenCV 2.4.5:
opencv_nonfree245d.lib
opencv_features2d245d.lib
In Project -> Properties -> linker -> Input -> Additional Dependencies.
I had the same error doing Feature Description tutorial and it fixed it.
Problem to run opencv patented SIFT and SURF although flag DOPENCV_ENABLE_NONFREE=ON is set
Build OpenCV with the following command:
cmake -D CMAKE_BUILD_TYPE=Release \
-D CMAKE_INSTALL_PREFIX=/usr/local \
-D OPENCV_EXTRA_MODULES_PATH=path/to/opencv_contrib/modules \
-D OPENCV_ENABLE_NONFREE=ON \
path/to/opencv
Related Topics
Std::Forward_List and Std::Forward_List::Push_Back
Looking for 16-Bit X86 Compiler
How to Extend a Lexical Cast to Support Enumerated Types
Passing a Pointer to a Class Member Function as a Parameter
C++ Inserting Unique_Ptr in Map
Return Statement in Ternary Operator C++
Library Is Linked But Reference Is Undefined
How to Check If a Key Is Pressed on C++
Why Can't Std::Ostream Be Moved
How to Include the String Header
C++ [Windows] Path to the Folder Where the Executable Is Located
Do C++11 Regular Expressions Work with Utf-8 Strings
C++ Concatenate Two Int Arrays into One Larger Array
Is C++ Static Member Variable Initialization Thread-Safe
Do Pthread Mutexes Work Across Threads If in Shared Memory