首页 > 代码库 > snip_opencv环境配置和测试程序

snip_opencv环境配置和测试程序

opencv2.4.9环境变量配置的记录. 2014年8月10日

Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:\Documents and Settings\Administrator>set
ALLUSERSPROFILE=C:\Documents and Settings\All Users
AltiumPath=D:\Program Files\Altium Designer Summer 09\System
ANS_OLD_ATTACH=1
APPDATA=http://www.mamicode.com/C:/Documents and Settings/Administrator/Application Data
CommonProgramFiles=C:\Program Files\Common Files
COMPUTERNAME=SMT
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Documents and Settings\Administrator
LOGONSERVER=\\SMT
NUMBER_OF_PROCESSORS=4
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Mi
crosoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS
\Binn\;D:\Program Files\Altium Designer Summer 09\System
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 6 Model 58 Stepping 9, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3a09
ProgramFiles=C:\Program Files
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
TMP=C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp
USERDOMAIN=SMT
USERNAME=Administrator
USERPROFILE=C:\Documents and Settings\Administrator
VS100COMNTOOLS=d:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\
windir=C:\WINDOWS
_DFX_INSTALL_UNSIGNED_DRIVER=1

C:\Documents and Settings\Administrator>\setx
‘\setx‘ 不是内部或外部命令,也不是可运行的程序
或批处理文件。

C:\Documents and Settings\Administrator>echo %Path% //查看缺省的PATH值
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microso
ft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn
\;D:\Program Files\Altium Designer Summer 09\System

C:\Documents and Settings\Administrator>^A^A


VS2010默认的设置。
—————————————————————————————————————————————
可执行文件的目录:(缺省设置(VS2010))

$(VCInstallDir)bin
$(WindowsSdkDir)bin\NETFX 4.0 Tools
$(WindowsSdkDir)bin
$(VSInstallDir)Common7\Tools\bin
$(VSInstallDir)Common7\tools
$(VSInstallDir)Common7\ide
$(ProgramFiles)\HTML Help Workshop
$(FrameworkSDKDir)\bin
$(MSBuildToolsPath32)
$(VSInstallDir)
$(SystemRoot)\SysWow64
$(FxCopDir)
$(PATH)


(INCLUIDE)缺省值: 包含头文件用的。

$(VCInstallDir)include
$(VCInstallDir)atlmfc\include
$(WindowsSdkDir)include
$(FrameworkSDKDir)\include

(LIBPATH)引用目录: using命令引用的文件使用

$(VCInstallDir)atlmfc\lib
$(VCInstallDir)lib

 

(LIB) 库目录: .dll, 。lib文件的目录

$(VCInstallDir)lib
$(VCInstallDir)atlmfc\lib
$(WindowsSdkDir)lib
$(FrameworkSDKDir)\lib
======
(.LIB)库目录中的链接项(缺省);
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
comdlg32.lib
advapi32.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
odbc32.lib
odbccp32.lib
-------------------------------------------------------

 

(1)2014年8月10日

1.1 添加INCLUDE目录。 在集成$includePath的基础上。
注: 选中从父级或项目默认设置集成。 默认:没有diy的目录。
添加的:
D:\opencv\build\include
D:\opencv\build\include\opencv
D:\opencv\build\include\opencv2

视图 → 属性管理器。。 在Microsoft.Cpp.Win32.user右键,属性中设置会永久保存的加载opencv的一些文件。
1.2(可选)
D:\opencv\build\x86\vc10\bin

1.3 库目录的设置.
D:\opencv\build\x86\vc10
D:\opencv\build\x86\vc10\bin
D:\opencv\build\x86\vc10\lib

环境变量设置:
用户变量:
[opencv] D:\opencv\build\
[PATH] D:\opencv\build\x86\vc10\bin;
系统变量:
[PATH] D:\opencv\build\x86\vc10\bin;
在x64位系统上调试的时候,在Debug小箭头右侧的平台选项,要设置为x64的,默认的是Win32的应用程序....


___________________________________________________________

Win32应用程序,测试程序。


// set_ENV.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <opencv2\opencv.hpp>
using namespace cv;

 


int _tmain(int argc, _TCHAR* argv[])
{
IplImage * src;
src = http://www.mamicode.com/cvLoadImage("D:\\lena.jpg", CV_LOAD_IMAGE_UNCHANGED);
cvNamedWindow("lena",CV_WINDOW_AUTOSIZE);
cvShowImage("lena",src);
cvWaitKey(0);
cvWaitKey(0);

cvDestroyWindow("lena");
//cvRelease(&src);
cvRelease((void**)&src);
return 0;
}

________________________

包含目录:

 具体需要制定的库文件,在链接项→输入中,进行设置, 可以百度opencv 2.4.9配置方法

opencv_calib3d244.lib 

opencv_calib3d244d.lib 

opencv_contrib244.lib 

opencv_contrib244d.lib 

opencv_core244.lib 

opencv_core244d.lib 

opencv_features2d244.lib 

opencv_features2d244d.lib 

opencv_flann244.lib 

opencv_flann244d.lib 

opencv_gpu244.lib 

opencv_gpu244d.lib 

opencv_haartraining_engine.lib 

opencv_haartraining_engined.lib 

opencv_highgui244.lib 

opencv_highgui244d.lib 

opencv_imgproc244.lib 

opencv_imgproc244d.lib 

opencv_legacy244.lib 

opencv_legacy244d.lib 

opencv_ml244.lib 

opencv_ml244d.lib 

opencv_nonfree244.lib 

opencv_nonfree244d.lib 

opencv_objdetect244.lib 

opencv_objdetect244d.lib 

opencv_photo244.lib 

opencv_photo244d.lib 

opencv_stitching244.lib 

opencv_stitching244d.lib 

opencv_ts244.lib 

opencv_ts244d.lib 

opencv_video244.lib 

opencv_video244d.lib 

opencv_videostab244.lib 

opencv_videostab244d.lib