Reputation: 51
I'm on Windows 10 and installed python3 and added OpenCV and OpenCV-contrib via pip. For the xfeatures_2d it gives the following error.
Can I add that option using pip?
detector = cv.xfeatures2d_SURF.create(hessianThreshold=minHessian)
cv2.error: OpenCV(3.4.3) C:\projects\opencv-python\opencv_contrib\modules\xfeatures2d\src\surf.cpp:1016: 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'
Upvotes: 4
Views: 10031
Reputation: 794
This solution worked for me!
pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com opencv-contrib-python==3.4.2.17
source :[https://www.programmersought.com/article/36184723625/]
Upvotes: 0
Reputation: 23052
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
Upvotes: 4