我尝试使用opencv配置visual studio 2013进行编程。我的操作系统是64位,我按照以下步骤操作。我已将opencv解压缩到C:。
在属性设置链接器部分 - > general->其他Libarary目录设置为C:\ opencv \ build \ include \ x64 \ vc12 \ lib
然后在链接器中 - >输入 - >附加依赖项我添加以下
opencv_calib3d249d.lib opencv_contrib249d.lib opencv_core249d.lib opencv_features2d249d.lib opencv_flann249d.lib opencv_gpu249d.lib opencv_highgui249d.lib opencv_imgproc249d.lib opencv_legacy249d.lib opencv_ml249d.lib opencv_nonfree249d.lib opencv_ocl249d opencv_objdetect249d.lib opencv_photo249d.lib opencv_stitching249d.lib opencv_superres249d.lib opencv_ts249d.lib opencv_video249d.lib opencv_videostab249d.lib
这些是我的C:\ opencv \ build \ x64 \ vc12 \ lib文件夹中的文件名称(有两个版本opencv_calib3d249d和opencv_calib3d249(最后没有d))
然后我将以下代码添加到我的cpp文件并尝试运行。
#include "opencv2/highgui/highgui.hpp"
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, const char** argv)
{
Mat img = imread("galpatha.JPG", CV_LOAD_IMAGE_UNCHANGED); //read the image data in the file "MyPic.JPG" and store it in 'img'
if (img.empty()) //check whether the image is loaded or not
{
cout << "Error : Image cannot be loaded..!!" << endl;
//system("pause"); //wait for a key press
return -1;
}
namedWindow("MyWindow", CV_WINDOW_AUTOSIZE); //create a window with the name "MyWindow"
imshow("MyWindow", img); //display the image which is stored in the 'img' in the "MyWindow" window
waitKey(0); //wait infinite time for a keypress
destroyWindow("MyWindow"); //destroy the window with the name, "MyWindow"
system("pause");
return 0;
}
它给了我错误
错误1错误LNK1104:无法打开文件'opencv_calib3d249d.lib'c:\ Users \ Kasun \ documents \ visual studio 2013 \ Projects \ OpenCV_test \ OpenCV_test \ LINK OpenCV_test