Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ OpenCV中重载函数的实例_C++_Opencv - Fatal编程技术网

C++ OpenCV中重载函数的实例

C++ OpenCV中重载函数的实例,c++,opencv,C++,Opencv,您好,我正在尝试实现一个快速功能检测器代码,在它的初始阶段,我得到以下错误 (1) 重载函数“cv::FastFeatureDetector::detect”的实例与参数列表不匹配 (2) “KeyPointsToPoints”未定义 请帮帮我 #include <stdio.h> #include "opencv2/core/core.hpp" #include "opencv2/features2d/features2d.hpp" #include "opencv2/highgu

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

(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;
 }
#包括
#包括“opencv2/core/core.hpp”
#包括“opencv2/features2d/features2d.hpp”
#包括“opencv2/highgui/highgui.hpp”
#包括“opencv2/nonfree/nonfree.hpp”
使用名称空间cv;
int main()
{
Mat img1=imread(“0000.jpg”,1);
Mat img2=imread(“0001.jpg”,1);
//检测左右图像中的关键点
快速特征检测器(50);
向量左关键点,右关键点;
检测器。检测(img1,左_关键点);
检测器。检测(img2,右_关键点);
向量左U点;
关键点停止点(左关键点、左关键点);
向量右切点(左切点.size());
返回0;
}

问题出在这一行:

Vector<KeyPoint> left_keypoints,right_keypoints;
向量左关键点、右关键点;
C++是区分大小写的,它认为
Vector
Vector
不同(它应该是什么)。我无法理解为什么
Vector
会起作用,我早就料到会有错误

只知道如何使用
向量
,而不知道如何使用
向量
,因此请尝试修复此错误并重试


此外,
KeyPointsToPoints
在OpenCV库中不存在(除非您自己编程),请确保您使用它来进行转换。

给定的代码存在一些小问题。首先,您缺少
使用名称空间std
,这是按照使用向量的方式使用向量所必需的。您还缺少矢量的include
#include
<代码>矢量也应使用小写字母v。我也不确定KeyPointsToPoints是否是OpenCV的一部分。您可能需要自己实现此功能。我不确定,我只是以前没见过

#include <stdio.h>
#include <vector>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/nonfree/nonfree.hpp"
using namespace cv;
using namespace std;
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;

for (int i = 0; i < left_keypoints.size(); ++i) 
{
    left_points.push_back(left_keypoints.pt);
}
vector<Point2f>right_points(left_points.size());

return 0;
}
#包括
#包括
#包括“opencv2/core/core.hpp”
#包括“opencv2/features2d/features2d.hpp”
#包括“opencv2/highgui/highgui.hpp”
#包括“opencv2/nonfree/nonfree.hpp”
使用名称空间cv;
使用名称空间std;
int main()
{
Mat img1=imread(“0000.jpg”,1);
Mat img2=imread(“0001.jpg”,1);
//检测左右图像中的关键点
快速特征检测器(50);
向量左关键点,右关键点;
检测器。检测(img1,左_关键点);
检测器。检测(img2,右_关键点);
向量左U点;
对于(int i=0;i

我没有测试上面的代码。查看OpenCV文档

您的OpenCV版本的文档对
cv::FastFeatureDetector::detect
有何评论?