OpenCV中findFundamentalMat函数错误

Error in function findFundamentalMat in OpenCV

本文关键字:错误 函数 findFundamentalMat OpenCV      更新时间:2023-10-16

我想用这个代码(源代码)在opencv中找到基本矩阵。

#include <iostream>
using namespace std;
#include <opencv2/opencv.hpp>
using namespace cv;    
int point_count = 100;
        vector<Point2f> points1(point_count);
        vector<Point2f> points2(point_count);
        // initialize the points here ... */
        for( int i = 0; i < point_count; i++ )
        {
           points1[i] = Point2f(10.0f, 20.0f);
           points2[i] = Point2f(0.3f, 40.0f);
        }
        Mat fundamental_matrix =
         findFundamentalMat(points1, points2, FM_RANSAC, 3, 0.99);

,但我得到错误在findFundamentalMat像这样

undefined reference to `cv::findFundamentalMat(cv::_InputArray const&, cv::_InputArray const&, int, double, double, cv::_OutputArray const&)'

请指出我做错了什么,并描述性的,因为我是新的OpenCv,谢谢。

对于Windows用户,您需要包含calib3d.hpp才能使用findFundamentalMat函数。

#include "opencv2/calib3d/calib3d.hpp"

链接器错误。您需要在您的链接器库中包含calib3d,可能还包括其他。