vs2010 静态使用 opencv 2.46 库
下载opencv2.46的库,假设解压到OpenCV246,设置如下:
在工程的c++的include目录下添加:OpenCV246\opencv\build\include
在工程的c++的lib目录下添加:OpenCV246\opencv\build\x86\vc10\staticlib
#include "stdafx.h" #include <opencv/highgui.h> // 这几个依赖库文件必须要添加, // 因为这些是OpenCV所使用的第三方库 #pragma comment( lib, "libjasperd.lib" ) #pragma comment( lib, "libjpegd.lib" ) #pragma comment( lib, "libpngd.lib" ) #pragma comment( lib, "libtiffd.lib" ) #pragma comment( lib, "zlibd.lib" ) #pragma comment( lib, "IlmImfd.lib" ) // 这里根据你的程序添加依赖库文件 #pragma comment( lib, "opencv_highgui246d.lib" ) #pragma comment( lib, "opencv_core246d.lib" ) // 添加这两个是因为win32程序 #pragma comment( lib, "vfw32.lib" ) #pragma comment( lib, "comctl32.lib" ) int main( int argc, char** argv ) { IplImage* img = cvLoadImage( "./lena.jpg" ); cvNamedWindow( "OpenCV", CV_WINDOW_AUTOSIZE ); cvShowImage( "OpenCV", img ); cvWaitKey(0); cvReleaseImage( &img ); cvDestroyWindow( "OpenCV" ); return ( 0 ); }
posted on 2013-07-31 16:00 sunws_king 阅读(477) 评论(0) 编辑 收藏 举报