我无法在openCV中运行camshift演示(I can't run camshift demo in openCV)
我在VS2010中安装openCV2.3.1。 我可以在openCV中读取图像而不会出现任何错误。 但是当我从文件夹open / samples / cpp运行camshiftdemo时。 它显示这个错误。
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:\users\pkru\documents\visual studio 2010\Projects\TestCmean\Debug\TestCmean.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:\users\pkru\documents\visual studio 2010\Projects\TestCmean\Debug\TestCmean.exe : fatal error LNK1120: 1 unresolved externals 1> 1>Build FAILE
I install openCV2.3.1 in VS2010. I can read image in openCV without any error. But when I run camshiftdemo from folder open/samples/cpp. It show this error.
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:\users\pkru\documents\visual studio 2010\Projects\TestCmean\Debug\TestCmean.exe : fatal error LNK1120: 1 unresolved externals 1> 1>Build FAILED
And when I comment this line // RotatedRect trackBox = CamShift(backproj, trackWindow, TermCriteria( CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 10, 1 )); It no error.
In my another code it show error like this. This is my code for test 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; }
when I run this code it show this error.
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:\users\pkru\documents\visual studio 2010\Projects\TestCmean\Debug\TestCmean.exe : fatal error LNK1120: 1 unresolved externals 1> 1>Build FAILE
原文:https://stackoverflow.com/questions/7397659
最满意答案
你错过了注入定义
'$ionicPopup', '$timeout'
.controller('MyCtrl', ['$scope', 'fileUpload', '$http', function($scope, fileUpload, $http, $ionicPopup, $timeout){
应该
.controller('MyCtrl', ['$scope', 'fileUpload', '$http', '$ionicPopup', '$timeout', function($scope, fileUpload, $http, $ionicPopup, $timeout){
希望这可以帮助。
You are missing the inject definition
'$ionicPopup', '$timeout'
.controller('MyCtrl', ['$scope', 'fileUpload', '$http', function($scope, fileUpload, $http, $ionicPopup, $timeout){
should be
.controller('MyCtrl', ['$scope', 'fileUpload', '$http', '$ionicPopup', '$timeout', function($scope, fileUpload, $http, $ionicPopup, $timeout){
hope this helps.
相关问答
更多-
请参阅以下jquery甜蜜警报插件 演示 通过引用必要的文件来初始化插件: 页面加载后调用sweetAlert函数 swal({ title: "Error!", text: "Here's my error message!", type: ...
-
这是我用来获取接近警报的服务,欢迎使用它,它不需要清单中的接收器,只需要服务 import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.BroadcastReceiver; import android.content.Context; import a ...
-
bootstrap警报不起作用(bootstrap alert not working)[2022-10-09]
将您的脚本包含在 ,然后使用alert()或您正在进行的任何库调用, 在加载库之前调用库函数 $('#openAlert').click(function () { $('#le-alert').addClass('in'); // ................. 应该* 之后 *