我正在 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);
但是,当我切换到我的 Mac 或 Linux 框时,我收到一条错误消息,指出参数没有函数原型(prototype)(因为函数原型(prototype)需要cv::Mat
代替 std::vector< cv::Point2f >
)
所以我的问题是,我可以/应该如何从 std::vector < cv::Point2f >
转换至 cv::Mat
或者我应该怎么做呢?
最佳答案
看来您在 Linux 上使用的是旧版本的 OpenCV。我认为,使用 vector 作为 openCV 函数输入的可能性已添加到 ver 2.3。
那么,快乐的更新!
关于c++ - OpenCV std::vector< cv::Point2f > 到 cv::Mat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8083011/