我无法在 openCV 中运行凸轮移位演示
I can't run camshift demo in openCV
我在VS2010中安装了openCV2.3.1。我可以在openCV中读取图像而没有任何错误。但是当我运行camshiftdemo从文件夹打开/samples/cpp。显示此错误。
1> All outputs are up-to-date.
1>main.obj : error LNK2019: unresolved external symbol "class cv::RotatedRect __cdecl cv::CamShift(class cv::_InputArray const &,class cv::Rect_<int> &,class cv::TermCriteria)" (?CamShift@cv@@YA?AVRotatedRect@1@ABV_InputArray@1@AAV?$Rect_@H@1@VTermCriteria@1@@Z) referenced in function _main
1>c:userspkrudocumentsvisual studio 2010ProjectsTestCmeanDebugTestCmean.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED
当我注释这行//RotatedRect trackBox = CamShift(backproj, trackWindow,TermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10,1));没有错误
在我的另一个代码中,它显示了这样的错误。这是我测试meanshift
的代码int main()
{
// Read reference image
cv::Mat image= cv::imread("Desert.jpg");
if (!image.data)
return 0;
// Define ROI
cv::Mat imageROI= image(cv::Rect(110,260,35,40));
cv::rectangle(image, cv::Rect(110,260,35,40),cv::Scalar(0,0,255));
// Display image
cv::namedWindow("Image");
cv::imshow("Image",image);
// Get the Hue histogram
int minSat=65;
ColorHistogram hc;
//cv::MatND colorhist= hc.getHueHistogram(imageROI,minSat);
ObjectFinder finder;
//finder.setHistogram(colorhist);
finder.setThreshold(0.2f);
// Convert to HSV space
cv::Mat hsv;
cv::cvtColor(image, hsv, CV_BGR2HSV);
// Split the image
vector<cv::Mat> v;
cv::split(hsv,v);
// Eliminate pixels with low saturation
cv::threshold(v[1],v[1],minSat,255,cv::THRESH_BINARY);
cv::namedWindow("Saturation");
cv::imshow("Saturation",v[1]);
// Get back-projection of hue histogram
int ch[1]={0};
cv::Mat result= finder.find(hsv,0.0f,180.0f,ch,1);
cv::namedWindow("Result Hue");
cv::imshow("Result Hue",result);
cv::bitwise_and(result,v[1],result);
cv::namedWindow("Result Hue and");
cv::imshow("Result Hue and",result);
// Second image
image= cv::imread("Desert.jpg");
// Display image
cv::namedWindow("Image 2");
cv::imshow("Image 2",image);
// Convert to HSV space
cv::cvtColor(image, hsv, CV_BGR2HSV);
// Split the image
cv::split(hsv,v);
// Eliminate pixels with low saturation
cv::threshold(v[1],v[1],minSat,255,cv::THRESH_BINARY);
cv::namedWindow("Saturation");
cv::imshow("Saturation",v[1]);
// Get back-projection of hue histogram
result= finder.find(hsv,0.0f,180.0f,ch,1);
cv::namedWindow("Result Hue");
cv::imshow("Result Hue",result);
// Eliminate low stauration pixels
cv::bitwise_and(result,v[1],result);
cv::namedWindow("Result Hue and");
cv::imshow("Result Hue and",result);
// Get back-projection of hue histogram
finder.setThreshold(-1.0f);
result= finder.find(hsv,0.0f,180.0f,ch,1);
cv::bitwise_and(result,v[1],result);
cv::namedWindow("Result Hue and raw");
cv::imshow("Result Hue and raw",result);
cv::Rect rect(110,260,35,40);
cv::rectangle(image, rect, cv::Scalar(0,0,255));
cv::TermCriteria criteria(cv::TermCriteria::MAX_ITER,10,0.01);
// cout << "meanshift= " << cv::meanShift(result,rect,criteria) << endl;
cv::rectangle(image, rect, cv::Scalar(0,255,0));
// Display image
cv::namedWindow("Image 2 result");
cv::imshow("Image 2 result",image);
cv::waitKey();
return 0;
}
当我运行这段代码时,它显示这个错误。
1> main.cpp
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>main.obj : error LNK2001: unresolved external symbol "int __cdecl cv::meanShift(class cv::_InputArray const &,class cv::Rect_<int> &,class cv::TermCriteria)" (?meanShift@cv@@YAHABV_InputArray@1@AAV?$Rect_@H@1@VTermCriteria@1@@Z)
1>c:userspkrudocumentsvisual studio 2010ProjectsTestCmeanDebugTestCmean.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILE
CamShift和meanShift方法是视频跟踪模块的一部分,所以你可能忘记链接opencv_videoXXX.lib
对于OpenCV 3.2添加链接为'-lopencv_video'
相关文章:
- 使用 OpenCV readNetFromTensorFlow 运行 Keras DNN 模型 (UNet):错误:操作
- 将 opencv 从 2.4.13 转换为 3.3.1 时由 cv::resize() 引起的运行错误
- Homebrew OS X OpenCV - 在另一台Mac上运行时寻找dylib
- cv:内存位置的异常 - 运行 openCV 代码 Visual Studio 2013 & Visual Studio 2017 - Windows 7
- 使用MATLAB通过MEX运行OPENCV代码在VisualStudio上可以使用
- 如何运行 opencv 示例冲浪匹配器
- 无法在OSX Yosemite(Macbook 8,1)中运行OpenCV示例
- 从另一台计算机运行opencv可执行文件
- 运行Opencv示例代码时出错
- 在没有visualstudio的计算机上运行opencv dll
- 收到 OpenCV 错误:运行 OpenCV 示例程序时内存不足:"stitching_detailed.cpp"
- 如何在微控制器上运行opencv
- 无法从 beaglebone 运行 OpenCV 代码
- 无法在 beagleBone Black 中运行 OpenCV 示例
- Qt Creator在尝试运行OpenCV程序时崩溃.[NTDLL.dll崩溃]
- 在云计算机〔Azure〕上运行OpenCV代码
- 运行OpenCV混合处理教程时出现UnsatisfiedLinkError
- 运行OpenCV HOG样例
- 无法在Windows 7计算机上的Microsoft Visual C++2010中运行OpenCV
- 如何在Windows 7中从命令提示符编译和运行opencv代码