OpenCV std :: vector <cv :: Point2f> to cv :: Mat

krs*_*ynx 5 c++ opencv

我正在OpenCV中开发一个应用程序,在Windows上,以下代码是有效的,并且编译/工作:

/* Calculate the transformation points */
std::vector<cv::Point2f> img1;
std::vector<cv::Point2f> img2;
for( int i = 0; i < good_matches.size(); i++ ) {
    img1.push_back( keypoints_imageOne[ good_matches[i].queryIdx ].pt );
    img2.push_back( keypoints_imageTwo[ good_matches[i].trainIdx ].pt );
}

/* Generate the homogonous matrix from the transformation points */
cv::Mat H = cv::findHomography(img1, img2, CV_RANSAC);
Run Code Online (Sandbox Code Playgroud)

但是,当我切换到我的MacLinux盒子时,我得到一个错误,说没有参数的函数原型(因为函数原型需要cv::Mat代替std::vector< cv::Point2f >)

所以我的问题是,我应该如何/应该如何std::vector < cv::Point2f >进行,cv::Mat或者我应该如何去做呢?

Sam*_*Sam 5

看来你在Linux上有一个旧版本的OpenCV.我认为使用向量作为openCV函数输入的可能性被添加到2.3版本中.

所以,快乐更新!