运行 opencv 专利 SIFT 和 SURF 的问题,尽管标志 DOPENCV_ENABLE_NONFREE=ON 已设置
Problem to run opencv patented SIFT and SURF although flag DOPENCV_ENABLE_NONFREE=ON is set
我目前正在研究 opencv 版本。 4.5.1
并且我想使用 SIFT 和 SURF 但我 运行 解决了众所周知的问题,它们已获得专利。我已经知道在 4.5.1
下可以使用标志 DOPENCV_ENABLE_NONFREE=ON
和 DBUILD_opencv_xfeatures2d=ON
。但是当我对 cmake
使用以下命令时
cmake -DOPENCV_EXTRA_MODULES_PATH=home/myname/opencv_build/opencv_contrib/modules/xfeatures2d/src -DOPENCV_ENABLE_NONFREE=ON -DBUILD_opencv_xfeatures2d=ON .
我运行遇到以下问题:
-- 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
clion 中的输出是:
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'
几个小时以来,我一直在拼命地尝试让程序 运行ning 和要执行的算法(SIFT、SURF),现在已经到了我(非常非常不情愿)想要降级的地步打开简历。 (我同时需要这个版本的opencv用于另一个项目)。
有没有人告诉我如何仍然可以让 5.4.1 下的算法在这里工作。否则,我应该使用哪个 OpenCV 版本 (c++) 才能毫无问题地使用 SIFT 和 SURF。在 c++ 的情况下,我没有发现如何降级版本。我发现的只是 python.
的情况
不胜感激!!!
使用以下命令构建 OpenCV:
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
使用SIFT算法无需重新构建OpenCV,使用4.4.0以上版本即可
版本亮点:
对于 python:
pip install opencv-python==4.4.0.46
并直接访问它(no more xfeatures2d
)
import cv2
sift = cv2.SIFT_create()
我目前正在研究 opencv 版本。 4.5.1
并且我想使用 SIFT 和 SURF 但我 运行 解决了众所周知的问题,它们已获得专利。我已经知道在 4.5.1
下可以使用标志 DOPENCV_ENABLE_NONFREE=ON
和 DBUILD_opencv_xfeatures2d=ON
。但是当我对 cmake
cmake -DOPENCV_EXTRA_MODULES_PATH=home/myname/opencv_build/opencv_contrib/modules/xfeatures2d/src -DOPENCV_ENABLE_NONFREE=ON -DBUILD_opencv_xfeatures2d=ON .
我运行遇到以下问题:
-- 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
clion 中的输出是:
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'
几个小时以来,我一直在拼命地尝试让程序 运行ning 和要执行的算法(SIFT、SURF),现在已经到了我(非常非常不情愿)想要降级的地步打开简历。 (我同时需要这个版本的opencv用于另一个项目)。
有没有人告诉我如何仍然可以让 5.4.1 下的算法在这里工作。否则,我应该使用哪个 OpenCV 版本 (c++) 才能毫无问题地使用 SIFT 和 SURF。在 c++ 的情况下,我没有发现如何降级版本。我发现的只是 python.
的情况不胜感激!!!
使用以下命令构建 OpenCV:
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
使用SIFT算法无需重新构建OpenCV,使用4.4.0以上版本即可
版本亮点:
对于 python:
pip install opencv-python==4.4.0.46
并直接访问它(no more xfeatures2d
)
import cv2
sift = cv2.SIFT_create()