【发布时间】:2012-10-20 04:14:18
【问题描述】:
我查看了这段代码 http://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html
//-- Localize the object
std::vector<Point2f> obj;
std::vector<Point2f> scene;
for( int i = 0; i < good_matches.size(); i++ )
{
//-- Get the keypoints from the good matches
obj.push_back( keypoints_object[ good_matches[i].queryIdx ].pt );
scene.push_back( keypoints_scene[ good_matches[i].trainIdx ].pt );
}
Mat H = findHomography( obj, scene, CV_RANSAC );
所以很自然地,我想以同样的方式将数据加载到 findHomography 中。 所以我的代码是
std::vector<cv::Point2f> srcPoints();
std::vector<cv::Point2f> dstPoints();
cv::Mat homography = cv::findHomography(srcPoints, dstPoints, CV_RANSAC);
但它给了我
1>c:\main.cpp(65): error C2665: 'cv::findHomography' : 2 个重载都不能转换所有参数类型 1> c:\opencv\build\include\opencv2\calib3d\calib3d.hpp(423): 可能是 'cv::Mat cv::findHomography(cv::InputArray,cv::InputArray,int,double,cv: :输出数组)' 1> c:\opencv\build\include\opencv2\calib3d\calib3d.hpp(428): 或 'cv::Mat cv::findHomography(cv::InputArray,cv::InputArray,cv::OutputArray,int,双倍的)' 1> 在尝试匹配参数列表“(重载函数,重载函数,int)”时 1> 1>构建失败。
如果我使用 CV::Mat 而不是 Vectors,它会起作用,但我不明白为什么与示例中相同的格式不应该起作用。
【问题讨论】:
标签: c++ opencv homography