c ++ opencv findHomography()函数中的未定义关系
c++ undefined rererence in opencv findHomography() function
我尝试了 运行 以下 opencv/c++ 示例中的代码片段 http://docs.opencv.org/3.1.0/d7/dff/tutorial_feature_homography.html#gsc.tab=0
部分代码如下:
std::vector<Point2f> obj;
std::vector<Point2f> scene;
for( size_t 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, RANSAC );
我得到以下编译错误
/home/yudori/Documents/qt_projects/featureTest/main.cpp:57: error: undefined reference to `cv::findHomography(cv::_InputArray const&, cv::_InputArray const&, int, double, cv::_OutputArray const&, int, double)'
上线
Mat H = findHomography( obj, scene, RANSAC );
我检查了 "calib3d.hpp" 头文件,它似乎包含 findHomography 函数的类似声明,但我不禁觉得我遗漏了一些东西。我是 运行 Ubuntu 上的 opencv 3.1.0,我对 c++ 还很陌生,请帮忙。
如果您正在处理 linux,请将其添加到您的编译字符串 -lopencv_calib3d,如果您正在处理 windows 和 visual studio,请添加 opencv_calib3d在其他图书馆中
我尝试了 运行 以下 opencv/c++ 示例中的代码片段 http://docs.opencv.org/3.1.0/d7/dff/tutorial_feature_homography.html#gsc.tab=0
部分代码如下:
std::vector<Point2f> obj;
std::vector<Point2f> scene;
for( size_t 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, RANSAC );
我得到以下编译错误
/home/yudori/Documents/qt_projects/featureTest/main.cpp:57: error: undefined reference to `cv::findHomography(cv::_InputArray const&, cv::_InputArray const&, int, double, cv::_OutputArray const&, int, double)'
上线
Mat H = findHomography( obj, scene, RANSAC );
我检查了 "calib3d.hpp" 头文件,它似乎包含 findHomography 函数的类似声明,但我不禁觉得我遗漏了一些东西。我是 运行 Ubuntu 上的 opencv 3.1.0,我对 c++ 还很陌生,请帮忙。
如果您正在处理 linux,请将其添加到您的编译字符串 -lopencv_calib3d,如果您正在处理 windows 和 visual studio,请添加 opencv_calib3d在其他图书馆中