I'm currently working on opencv vers. 4.5.1
and I want to use SIFT and SURF but I run into the well known problem that they're patented. I already know that under 4.5.1
there is the possibility to use the flags DOPENCV_ENABLE_NONFREE=ON
and DBUILD_opencv_xfeatures2d=ON
. But when I use the following command for cmake
cmake -DOPENCV_EXTRA_MODULES_PATH=home/myname/opencv_build/opencv_contrib/modules/xfeatures2d/src -DOPENCV_ENABLE_NONFREE=ON -DBUILD_opencv_xfeatures2d=ON .
I run into the following problem:
-- The C compiler identification is GNU 9.3.0
-- The CXX compiler identification is GNU 9.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "4.5.1")
-- OpenCV library status:
-- config: /usr/local/lib/cmake/opencv4
-- version: 4.5.1
-- libraries: opencv_calib3d;opencv_core;opencv_dnn;opencv_features2d;opencv_flann;opencv_gapi;opencv_highgui;opencv_imgcodecs;opencv_imgproc;opencv_ml;opencv_objdetect;opencv_photo;opencv_stitching;opencv_video;opencv_videoio;opencv_aruco;opencv_bgsegm;opencv_bioinspired;opencv_ccalib;opencv_datasets;opencv_dnn_objdetect;opencv_dnn_superres;opencv_dpm;opencv_face;opencv_freetype;opencv_fuzzy;opencv_hfs;opencv_img_hash;opencv_intensity_transform;opencv_line_descriptor;opencv_mcc;opencv_optflow;opencv_phase_unwrapping;opencv_plot;opencv_quality;opencv_rapid;opencv_reg;opencv_rgbd;opencv_saliency;opencv_shape;opencv_stereo;opencv_structured_light;opencv_superres;opencv_surface_matching;opencv_text;opencv_tracking;opencv_videostab;opencv_wechat_qrcode;opencv_xfeatures2d;opencv_ximgproc;opencv_xobjdetect;opencv_xphoto
-- include path: /usr/local/include/opencv4
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_opencv_xfeatures2d
OPENCV_ENABLE_NONFREE
OPENCV_EXTRA_MODULES_PATH
-- Build files have been written to: /home/myname/Dokumente/test/project
The output in clion is:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.1-dev) /home/myname/opencv_build/opencv_contrib/modules/xfeatures2d/src/surf.cpp:1027: 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'
For hours I have been desperately trying to get the program running and the algorithms (SIFT, SURF) to be executed and have now reached the point where I (very, very reluctantly) want to downgrade opencv. (I simultaneously need this version of opencv for another project).
Does anyone have a tip for me on how I can still get the algorithms under 5.4.1 to work here. And otherwise, which OpenCV version (c++) should I use in order to use SIFT and SURF without problems. I did not find anything how I can downgrade the version in case of c++. All I found was in case of python.
Help would be very much appreciated!!!
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