3

我是视频稳定领域的新手。现在我正在研究它。我正在编写一个小型视频稳定演示。但是我遇到了一些问题我在 OpenCV 中使用函数“estimateGlobalMotionLeastSquares”来估计全局运动但它不起作用

这是我的代码:

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

例如:我创建 2 个变量 p0,p1 作为函数“estimateGlobalMotionLeastSquares”的参数,我想估计全局运动“t”。但是当我遵守时,错误如下:

1>VS_OpenCVDlg.obj:错误 LNK2001:无法解析的外部符号“类 cv::Mat __cdecl cv::videostab::estimateGlobalMotionLeastSquares(类 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 : 致命错误 LNK1120: 1 unresolved externals

请帮我解决这个问题!!!你能给我一些关于那个功能的例子吗?

4

1 回答 1

3

尝试包含正确的文件:

#include "opencv2/videostab/videostab.hpp"

并将您的代码更改为:

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);
于 2014-06-18T11:55:08.783 回答