不可能创建SIFT检测器和提取器

Impossible to create SIFT detector and extractor

本文关键字:提取 检测器 创建 SIFT 不可能      更新时间:2023-10-16

我正在尝试使用以下代码检测 SIFT 关键点:

#include "opencv2/features2d/features2d.hpp"
#include "opencv2/nonfree/nonfree.hpp"
#include "opencv2/nonfree/features2d.hpp"
[...]
Ptr<FeatureDetector> detector = FeatureDetector::create( "SIFT" );
vector<KeyPoint> keyPoints;
detector->detect( image, keyPoints );
The problem is that my detector pointer points to nowhere after that last line, and no error is shown in the console.

我正在使用QtCreator,我的.pro文件包含:

LIBS += -lopencv_nonfree
CONFIG += link_pkgconfig
PKGCONFIG += opencv

所以我的制作文件包含:

LIBS          = $(SUBLIBS) -lopencv_nonfree [...]  /usr/local/lib/libopencv_nonfree.so [...]

加载库时没有错误。

我已经使用这些说明安装了opencv。

我忘了在做其他事情之前打电话给cv::initModule_nonfree();