OpenCV - 编译器找不到 features2d.hpp 的 drawKeypoints?

Posted

技术标签:

【中文标题】OpenCV - 编译器找不到 features2d.hpp 的 drawKeypoints?【英文标题】:OpenCV - compiler can't find drawKeypoints of features2d.hpp? 【发布时间】:2016-07-07 20:12:10 【问题描述】:

我正在尝试使用 drawKeypoints 函数。 我就是这样称呼它的:

drawKeypoints( img1, keypoints1, final, color, flags);

地点:

img1 = my image (Mat)
keypoints = vector<KeyPoint> generated from calling the ORB detector
final = output Mat
color = Scalar::all(-1)
flags = DrawMatchesFlags::DEFAULT;

但我收到此链接错误:

Undefined symbols for architecture x86_64:
  "cv::drawKeypoints(cv::_InputArray const&, std::vector<cv::KeyPoint, std::allocator<cv::KeyPoint> > const&, cv::_InputOutputArray const&, cv::Scalar_<double> const&, int)", referenced from:

这些是我的包括:

#include <opencv2/core/core.hpp>
#include "opencv2/imgcodecs/imgcodecs.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/opencv.hpp"
#include "opencv2/highgui/highgui.hpp"

为什么我的编译器 (XCode) 找不到该函数?

谢谢!

【问题讨论】:

【参考方案1】:

您需要链接到 OpenCV"opencv_features2d" 库,该库提供了cv::drawKeypoints 函数。

查看红色和蓝色轮廓框on this answer。

【讨论】:

以上是关于OpenCV - 编译器找不到 features2d.hpp 的 drawKeypoints?的主要内容,如果未能解决你的问题,请参考以下文章

Glibcxx 编译 FREAK OpenCV 演示文件时出错

ubuntu上opencv中的错误/usr/include/opencv2/nonfree/features2d.hpp错误向量

有没有办法修复编译器找不到特定的 openCV 变量/函数?

MinGW C++ 编译器在系统路径中找不到 OpenCV

无法编译第一个 opencv 程序,'/usr/bin/ld: 找不到 -lcv'

Ubuntu找不到OpenCV里的xml文件