Rahul K Singh Rahul K Singh - 1 year ago 247
C++ Question

Error in function findFundamentalMat in OpenCV

I want to use this code(source) to find fundamental matrix in 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);

but I am getting error in findFundamentalMat like this

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

Please point out what I am doing wrong and be descriptive as I am new to OpenCv, thanks.

Answer Source

Linker error. You need to include in your linker libraries the calib3d one, possibly others.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download