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

时间:2016-07-07 20:12:11

标签: c++ opencv

我正在尝试使用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 个答案:

答案 0 :(得分:0)

您需要链接 OpenCV &#34; opencv_features2d&#34; 库,该库提供cv::drawKeypoints功能。

请参阅红色和蓝色边框on this answer