我试图用OpenCV运行visual c ++。我已将OpenCV链接到Visual Studio 2012.当我尝试运行代码时,它给了我一个错误;
LINK : fatal error LNK1104: cannot open file 'opencv_calib2d246.dll'
这是我想要做的事情:
#include "stdafx.h"
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\core\core.hpp"
#include<iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
if(argc !=2)
{
cout <<"usage: display_image ImageToLoadAndDisplay"<<endl;
return -1;
}
Mat image;
image=imread(argv[1],CV_LOAD_IMAGE_UNCHANGED);
if(! image.data)
{
cout<<"couldn't open or find the image"<<endl;
return -1;
}
namedWindow("Display Window",WINDOW_AUTOSIZE);
imshow("Display Window",image);
waitKey(0);
return 0;
}
我已经包含了所有库。我在Windows 7 32位系统上使用OpenCV 2.4.6。
我还需要添加什么,还是必须在程序中初始化它?
更新
我的硬盘中的OpenCV路径:E:\opencv\opencv
。系统环境变量中的路径:%OPENCV_DIR%\x86\vc11\bin;
,其中我创建了一个新变量OPENCV_DIR并将路径指定为E:\opencv\opencv\build
。并在linker\command line
/ OUT:&#34; E:\ VS2012 Projects \ cvtest \ Debug \ cvtest.exe&#34; / MANIFEST / NXCOMPAT / PDB:&#34; E:\ VS2012 Projects \ cvtest \ Debug \ cvtest.pdb&#34; / DYNAMICBASE&#34; opencv_calib3d248.lib&#34; &#34; opencv_calib3d248d.lib&#34; &#34; opencv_contrib248.lib&#34; &#34; opencv_contrib248d.lib&#34; &#34; opencv_core248.lib&#34; &#34; opencv_core248d.lib&#34; &#34; opencv_features2d248.lib&#34; &#34; opencv_features2d248d.lib&#34; &#34; opencv_flann248.lib&#34; &#34; opencv_flann248d.lib&#34; &#34; opencv_gpu248.lib&#34; &#34; opencv_gpu248d.lib&#34; &#34; opencv_highgui248.lib&#34; &#34; opencv_highgui248d.lib&#34; &#34; opencv_imgproc248.lib&#34; &#34; opencv_imgproc248d.lib&#34; &#34; opencv_legacy248.lib&#34; &#34; opencv_legacy248d.lib&#34; &#34; opencv_ml248.lib&#34; &#34; opencv_ml248d.lib&#34; &#34; opencv_nonfree248.lib&#34; &#34; opencv_nonfree248d.lib&#34; #&34; opencv_objdetect248.lib&#34; &#34; opencv_objdetect248d.lib&#34; &#34; opencv_ocl248.lib&#34; &#34; opencv_ocl248d.lib&#34; &#34; opencv_photo248.lib&#34; &#34; opencv_photo248d.lib&#34; &#34; opencv_stitching248.lib&#34; &#34; opencv_stitching248d.lib&#34; &#34; opencv_superres248.lib&#34; &#34; opencv_superres248d.lib&#34; &#34; opencv_ts248.lib&#34; &#34; opencv_ts248d.lib&#34; &#34;&opencv_video248.lib#34; &#34; opencv_video248d.lib&#34; &#34; opencv_videostab248.lib&#34; &#34; opencv_videostab248d.lib&#34; &#34; KERNEL32.LIB&#34; &#34; USER32.LIB&#34; &#34; GDI32.LIB&#34; &#34; winspool.lib&#34; &#34; comdlg32.lib&#34; &#34; advapi32.lib&#34; &#34; SHELL32.LIB&#34; &#34; ole32.lib&#34; &#34; oleaut32.lib&#34; &#34; UUID.LIB&#34; &#34; odbc32.lib&#34; &#34; odbccp32.lib&#34; / DEBUG / MACHINE:X86 / INCREMENTAL / PGD:&#34; E:\ VS2012 Projects \ cvtest \ Debug \ cvtest.pgd&#34; / MANIFESTUAC:&#34;电平=&#39; asInvoker&#39; uiAccess =&#39;假&#39;&#34; /ManifestFile:"Debug\cvtest.exe.intermediate.manifest" / ERRORREPORT:PROMPT / NOLOGO / TLBID:1
现在我无法加载图片。没有致命错误,也没有。它正在考虑if语句而不加载任何东西。
有什么建议吗?