SIFT and SURF are examples of algorithms that OpenCV calls “non-free” modules. These algorithms are patented by their respective creators, and they are free to use in academic and research settings and installed with this command:
pip install opencv-contrib-python
However after installation, using SURF algorithm cause the error:
OpenCV(3.4.11) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-neg5amx3\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1029: error:
(-213:The function/feature is not implemented) This algorithm is patented and is excluded in this
configuration; Set OPENCV_ENABLE_NONFREE CMake option and rebuild the library in function
'cv::xfeatures2d::SURF::create'
the error exist in version 4.6.0.66 of opencv-contrib-python. this is my code to use SURF
SURF = cv.xfeatures2d.SURF_create()
kp,des = FREAK.compute(img_gray,kp)