How to use opencv_contrib functions?

asked 2019-07-26 01:22:09 -0600

I have installed opencv and opencv_contrib in a conda environment using pip. Though I am getting this error :

cv2.error: OpenCV(4.1.0) /io/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 'create'

How to solve this? Do I need to download and build opencv from the github? If yes, then how?

edit retag flag offensive close merge delete

Comments

1

you have to build opencv_contrib yourself using cmake and your favourite C++ compiler

LBerger gravatar imageLBerger ( 2019-07-26 03:16:24 -0600 )edit

@LBerger said, you don't have to re-install agian. You simply deleting inside build' s folder and then do cmake. For python 3.x used pip3.

supra56 gravatar imagesupra56 ( 2019-07-26 06:28:05 -0600 )edit
1

@supra56, the pip maintainer choose not to enable the OPENCV_ENABLE_NONFREE flag (a concious decision) so no pip built opencv_contrib_python after 3.2 will have SIFT or SURF, meaning:

if you need it, you HAVE to build locally from src. please do not blindly recommend to use pip here.

berak gravatar imageberak ( 2019-07-29 09:03:59 -0600 )edit