我试着写一个程序来测试光流使用opencv,但当它链接它给出这个错误:
error LNK2019: unresolved external symbol "void __cdecl cv::calcOpticalFlowPyrLK(class
cv::_InputArray const &,class cv::_InputArray const &,class cv::_InputArray const
&,class cv::_OutputArray const &,class cv::_OutputArray const &,class cv::_OutputArray
const &,class cv::Size_<int>,int,class cv::TermCriteria,double,int,double)" (?
calcOpticalFlowPyrLK@cv@@YAXABV_InputArray@1@00ABV_OutputArray@1@11V?
$Size_@H@1@HVTermCriteria@1@NHN@Z) referenced in function _main
E:DocumentsProjectsVisualStudioLKMethod2LKMethod2main.obj
通常是因为链接库没有被包括在内,但这次我在链接器->输入->附加依赖项中包含了这些opencv的库,如下:
C:sdksopencvbuildx86vc11libReleaseopencv_calib3d244.lib
...
...
C:sdksopencvbuildx86vc11installlibopencv_video244.lib
C:sdksopencvbuildx86vc11installlibopencv_videostab244.lib
最奇怪的是,只有这个calcOpticalFlowPyrLK函数有链接错误,而其他函数没有链接错误。(但我确实包含了openv_video)。我试图重建openv库,但徒劳。请帮我解决一下,谢谢。
你应该使用
-
opencv_calib3d244d.lib
代替opencv_calib3d244.lib
-
opencv_video244d.lib
代替opencv_video244.lib
-
pencv_videostab244d.lib
代替pencv_videostab244.lib