c++ - OpenCV std::vector< cv::Point2f > 到 cv::Mat

标签 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);

但是,当我切换到我的 MacLinux 框时,我收到一条错误消息,指出参数没有函数原型(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/

相关文章:

c++ - 在 "Modern C++ Design"/Loki 中找到的小对象分配器是否已被弃用以支持更新的实现?

python - 值错误 : cannot reshape array of size 230 into shape (3, 600,800)

visual-studio - 为 TLD 运行 compile.m 时出错

c++ - cmake错误: "cc: error: unrecognized command line option ‘-std=c++20’ ; did you mean ‘-std=c++2a’ ?“

python - 为图像对比度度量实现直方图扩展

c++ - 当我构建隐藏窗口(在后台运行)时,如何在 'opencv' 函数中使用获取像素颜色?

python-3.x - Qt : Session management error in opencv python

c++ - 使用Throw and Catch的未处理异常运行时错误

c++ - 简单的链接器错误,找不到解决方案

c++ - D3D11 中没有三分量每 channel 8 位 DXGI 纹理格式吗?