win 7 + VC++ 2008 express + OpenCv 2.1.0安装
来源:互联网 发布:淘宝账号解封软件 编辑:程序博客网 时间:2024/06/14 09:54
官方文档并注释:
These instructions were tested with Visual C++ 9.0 (as part of Visual Studio 2008 Professional). These instructions should work without modification with Visual Studio 2005 and 2003. Modifications may be necessary for Visual Studio Express editions. These instructions do not apply to Visual Studio 2010 which uses different settings (see VisualC++).
Install OpenCV
Download the OpenCV 2.1.0 Windows installer from SourceForge - "OpenCV-2.1.0-win32-vs2008.exe".
Install it to a folder (without any spaces in it), say "C:\OpenCV2.1\". This article will refer to this path as $openCVDir
During installation, enable the option "Add OpenCV to the system PATH for all users".
由于有些函数需要TBB,所以需要将tbb所在的目录也加入到环境变量Path中如C:\TBB\bin\ia32\vc9 加入后可能需要注销当前Windows用户(或重启)后重新登陆才生效
Configure Visual Studio
Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories
Choose "Show directories for: Include files"
Add "$openCVDir\include\opencv"
Choose "Show directories for: Library files"
Add "$openCVDir\lib"
如果使用了DirectShow, Add "../DirectShow/Lib"(看具体情况)
Choose "Show directories for: Source files"
Add "$openCVDir\src\cv"
Add "$openCVDir\src\cvaux"
Add "$openCVDir\src\cxcore"
Add "$openCVDir\src\highgui"
Add "$openCVDir\src\ml"
Configure your Project
After you've created a project you'll need to add the OpenCV dependencies.(debug 和release 都添加)
Open Project Properties: Project > %projectName% Properties...
Open Linker Input properties: Configuration Properties > Linker > Input
Open the "..." window to edit "Additional Dependencies" and on each line put:
"cv210.lib"
"cxcore210.lib"
"highgui210.lib"
“ml210.lib”
“cvaux210.lib”
Your project should now build. If you get any errors try restarting Visual Studio and then doing a clean Rebuild.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//e.jpg要放在opencv\opencv里
These instructions were tested with Visual C++ 9.0 (as part of Visual Studio 2008 Professional). These instructions should work without modification with Visual Studio 2005 and 2003. Modifications may be necessary for Visual Studio Express editions. These instructions do not apply to Visual Studio 2010 which uses different settings (see VisualC++).
Install OpenCV
Download the OpenCV 2.1.0 Windows installer from SourceForge - "OpenCV-2.1.0-win32-vs2008.exe".
Install it to a folder (without any spaces in it), say "C:\OpenCV2.1\". This article will refer to this path as $openCVDir
During installation, enable the option "Add OpenCV to the system PATH for all users".
由于有些函数需要TBB,所以需要将tbb所在的目录也加入到环境变量Path中如C:\TBB\bin\ia32\vc9 加入后可能需要注销当前Windows用户(或重启)后重新登陆才生效
Configure Visual Studio
Open VC++ Directories configuration: Tools > Options > Projects and Solutions > VC++ Directories
Choose "Show directories for: Include files"
Add "$openCVDir\include\opencv"
Choose "Show directories for: Library files"
Add "$openCVDir\lib"
如果使用了DirectShow, Add "../DirectShow/Lib"(看具体情况)
Choose "Show directories for: Source files"
Add "$openCVDir\src\cv"
Add "$openCVDir\src\cvaux"
Add "$openCVDir\src\cxcore"
Add "$openCVDir\src\highgui"
Add "$openCVDir\src\ml"
Configure your Project
After you've created a project you'll need to add the OpenCV dependencies.(debug 和release 都添加)
Open Project Properties: Project > %projectName% Properties...
Open Linker Input properties: Configuration Properties > Linker > Input
Open the "..." window to edit "Additional Dependencies" and on each line put:
"cv210.lib"
"cxcore210.lib"
"highgui210.lib"
“ml210.lib”
“cvaux210.lib”
And any other lib file necessary for your project
Your project should now build. If you get any errors try restarting Visual Studio and then doing a clean Rebuild.
如果使用了DirectShow or DirectX, 在vs的解决方案资源管理器中右键相应的项目,选择属性,在属性窗口的 配置属性 -> C/C++ -> 常规 中的 附加包含目录,点击其右边的小按钮,在弹出的附加包含目录中,确保条目 $(WindowsSdkDir)\include 和 $(FrameworkSDKDir)include 在任何dx目录如..\DirectShow\Include的前面。如果要在全局配置添加头文件目录,也要遵循这个原则
用下面的程序测试:
// OpenCV_Helloworld.cpp : Defines the entry point for the console application.// Created for build/install tutorial, Microsoft Visual C++ 2008 Express and OpenCV //2.1.0
C++ Code
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include "stdafx.h"
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR *argv[])
{
IplImage *img = cvLoadImage("e.jpg");
cvNamedWindow("Image:", 1);
cvShowImage("Image:", img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int _tmain(int argc, _TCHAR *argv[])
{
IplImage *img = cvLoadImage("e.jpg");
cvNamedWindow("Image:", 1);
cvShowImage("Image:", img);
cvWaitKey();
cvDestroyWindow("Image:");
cvReleaseImage(&img);
return 0;
}
//e.jpg要放在opencv\opencv里
参考:OPencvChina官网
- win 7 + VC++ 2008 express + OpenCv 2.1.0安装
- win 7 + VC++ 2008 express + OpenCv 2.1.0安装
- VC 2008 Express下安装OpenCV 2.3.0
- VC 2008 Express下安装OpenCV2.0/2.1
- VC 2008 Express下安装OpenCV2.0/2.1
- VC 2008 Express下安装OpenCV2.0/2.1
- VC 2008 Express 编译OpenCV2.0/2.1
- win 7安装node.js及web应用框架express
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- VC 2008 Express下安装OpenCV2.3.1
- 手把手教你实现SVM算法(一)
- MATLAB 学习
- 详解2D-PCA (二维PCA)
- 手把手教你实现SVM算法(二)
- xCode工程的文件夹类型 folder References group
- win 7 + VC++ 2008 express + OpenCv 2.1.0安装
- 缺陷管理--软件缺陷的优先级
- ArcGIS Server10.1资料集锦
- Ubuntu 12.04 + opencv 2.4.1 + Qt 4.8.3 + Qt creater 2.5.2 安装配置
- hibernate增、删、改、查(CRUD)
- CSS和javascript+jQuery技巧小结
- ubuntu下安装qt的mysql驱动遇到的问题
- 几种截屏方法
- Oracle Stream配置详细步骤