VS2010 配置opencv2.4.3 测试
VS2010 配置opencv2.4.3 测试 求助
一步一步按照opencv china网站上配置的,
结果还是出现好多错误。
下面是代码
#include "stdafx.h"
#include <E:/opencv/include/opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
const char* imagename = "lena.jpg";
//从文件中读入图像
Mat img = imread(imagename);
//如果读入图像失败
if(img.empty())
{
fprintf(stderr, "Can not load image %s\n", imagename);
return -1;
}
//显示图像
imshow("image", img);
//此函数等待按键,按键盘任意键就返回
waitKey();
return 0;
}
————————————————————————————————————
错误是:1>E:/opencv/include/opencv2/opencv.hpp(46): fatal error C1083: 无法打开包括文件:“opencv2/core/core_c.h”: No such file or directory
还有using namespace cv;中的 cv 有错,就是下面有红线。。。还有Mat,imread,imshow,waitkey 都有红线。
------解决方案--------------------
不要参照OpenCV China网站的做法,参考这里(http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html)一步步进行。
一步一步按照opencv china网站上配置的,
结果还是出现好多错误。
下面是代码
#include "stdafx.h"
#include <E:/opencv/include/opencv2/opencv.hpp>
using namespace std;
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
const char* imagename = "lena.jpg";
//从文件中读入图像
Mat img = imread(imagename);
//如果读入图像失败
if(img.empty())
{
fprintf(stderr, "Can not load image %s\n", imagename);
return -1;
}
//显示图像
imshow("image", img);
//此函数等待按键,按键盘任意键就返回
waitKey();
return 0;
}
————————————————————————————————————
错误是:1>E:/opencv/include/opencv2/opencv.hpp(46): fatal error C1083: 无法打开包括文件:“opencv2/core/core_c.h”: No such file or directory
OpenCV
Visual Studio 2010
命名空间
------解决方案--------------------
不要参照OpenCV China网站的做法,参考这里(http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html)一步步进行。