OpenCV中重载函数的实例

Jan*_*ghe 2 c++ opencv

您好我正在尝试实现快速特征检测器代码,在它的初始阶段我得到以下错误

(1)没有重载函数的实例"cv :: FastFeatureDetector :: detect"匹配参数列表

(2)"KeyPointsToPoints"未定义

请帮我.

#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
int main()
{
  Mat img1 = imread("0000.jpg", 1);
  Mat img2 = imread("0001.jpg", 1);
 // Detect keypoints in the left and right images
FastFeatureDetector detector(50);
Vector<KeyPoint> left_keypoints,right_keypoints;
detector.detect(img1, left_keypoints);
detector.detect(img2, right_keypoints);
vector<Point2f>left_points;
KeyPointsToPoints(left_keypoints,left_points);
vector<Point2f>right_points(left_points.size());

 return 0;
 }
Run Code Online (Sandbox Code Playgroud)

Mic*_*man 7

问题出在这一行:

Vector<KeyPoint> left_keypoints,right_keypoints;
Run Code Online (Sandbox Code Playgroud)

C++区分大小写,它看到Vector的东西不同于vector(它本应该是什么).为什么Vector工作超出我的范围,我原本预计会出现错误.

cv::FastFeatureDetector::detect只知道如何使用vector,而不是Vector,所以尝试修复此错误,然后再试一次.

此外,KeyPointsToPointsOpenCV库中不存在(除非您自己编程),请确保使用KeyPoint::convert(const vector<KeyPoint>&, vector<Point2f>&)转换.