由于项目需要,今天学习了下opencv,我用的vs2010,opencv版本是3.1.0,按照教程下载后配置环境变量,然后配置包含目录:
E:\Opencv\opencv\build\include\opencv2;E:\Opencv\opencv\build\include;E:\Opencv\opencv\build\include\opencv
以及库目录:
E:\Opencv\opencv\build\x64\vc14\lib
E:\Opencv\opencv\build\x64\vc12\lib
,在此基础上配置连接器--输入--附加依赖项为:
opencv_highgui243d.lib
opencv_calib3d243d.lib
opencv_contrib243d.lib
opencv_core243d.lib
opencv_features2d243d.lib
opencv_flann243d.lib
IlmImfd.lib
opencv_gpu243d.lib
opencv_imgproc243d.lib
opencv_legacy243d.lib
opencv_ml243d.lib
opencv_objdetect243d.lib
opencv_ts243d.lib
opencv_video243d.lib
opencv_world310d.lib
然后编写测试代码如下:
// OpenCvTest.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include<cv.h>
#include<cxcore.h>
#include<highgui.h>
using namespace cv;
int main()
{
IplImage *img = cvLoadImage("C:\\Users\\Administrator\\Desktop\\test.jpg");
cvNamedWindow("Image:",1);
cvShowImage("Image:",img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
运行后弹出如下错误:
LINK : fatal error LNK1104: 无法打开文件“opencv_highgui243d.lib”
出现错误后我又重新检查了路径配置发现没有问题,不知道错在哪里,各位大神有知道的,求助啊!!