Question

I am a newbie about Video Stabilization field. Now I am researching about it. I'm coding a small video stabilization demo. But I am stuck in some problems I use the function "estimateGlobalMotionLeastSquares" in OpenCV to estimate global motion But it doesn't work

Here is my code:

CvPoint2D32f p0, p1;
vector<Point2f,allocator<Point2f>> ax, by;
ax.push_back(Point2f(2,2));
by.push_back(Point2f(3,2));
Mat t = estimateGlobalMotionLeastSquares(ax,by,AFFINE,0);

For example: I create 2 variables p0,p1 as parameter for the function " estimateGlobalMotionLeastSquares" and I want to estimate global motion "t". But when I complied, the error is as:

1>VS_OpenCVDlg.obj : error LNK2001: unresolved external symbol "class cv::Mat __cdecl cv::videostab::estimateGlobalMotionLeastSquares(class std::vector,class std::allocator > > const &,class std::vector,class std::allocator > > const &,int,float *)" (?estimateGlobalMotionLeastSquares@videostab@cv@@YA?AVMat@2@ABV?$vector@V?$Point_@M@cv@@V?$allocator@V?$Point_@M@cv@@@std@@@std@@0HPAM@Z) 1>F:\Research\Workspace\VS_OpenCV\Debug\VS_OpenCV.exe : fatal error LNK1120: 1 unresolved externals

Please help me to fix this!!! Can you give me some examples about that function it?

Was it helpful?

Solution

Try to include the proper file :

#include "opencv2/videostab/videostab.hpp"

And change your code to :

CvPoint2D32f p0, p1;
vector<Point2f,allocator<Point2f>> ax, by;
ax.push_back(Point2f(2,2));
ax.push_back(Point2f(2,3));
ax.push_back(Point2f(2,4));
by.push_back(Point2f(3,2));
by.push_back(Point2f(3,3));
by.push_back(Point2f(3,4));
Mat t = videostab::estimateGlobalMotionLeastSquares(ax,by,3,0);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top