Chinaunix首页 | 论坛 | 博客
  • 博客访问: 662963
  • 博文数量: 111
  • 博客积分: 5010
  • 博客等级: 大校
  • 技术积分: 1461
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-08 14:40
文章分类

全部博文(111)

文章存档

2010年(10)

2009年(70)

2008年(31)

我的朋友

分类: C/C++

2008-04-16 17:26:53

OpenCV will install to C:\Program Files\OpenCV
OpenCV 的安装目录为:C:\Program Files\OpenCV


添加下面的路径到环境变量PATH:
C:\Program Files\OpenCV\bin;
C:\Program Files\OpenCV\otherlibs\highgui;

DevCPP 与 OpenCV 的配置

在DevCPP中,Go to Tools->Compiler Options. It should come up with the Compiler tab selected.Check the box labeled Add these commands to the linker command line and type (or copy-paste) the following into the text box:
工具->编译器选项\编译器选项卡中,把“在连接器命令行中加入以下命令”复选框 选上,并且加入以下字符:
-lhighgui -lcv -lcxcore -lcvaux -lcvcam

Switch to the Directories tab, and in the Libraries sub-tab add to directories:
切换到“目录”tab,并且在“库”中加入以下目录:
C:\Program Files\OpenCV\lib

Switch to the C includes tab. Add :
切换到“C包含文件”tab,并且其中加入以下目录:
C:\Program Files\OpenCV\cxcore\include
C:\Program Files\OpenCV\cv\include 
C:\Program Files\OpenCV\otherlibs\highgui
C:\Program Files\OpenCV\cvaux\include
C:\Program Files\OpenCV\otherlibs\cvcam\include

到此为止,DevCPP 与 OpenCV才能正常的工作了。

以下为OpenCV与VS2005以及g++的配置:

OpenCV with VS2005
The follwing instructions are for setting up OpenCV inside Win XP/2000 using the Visual Studio 2005 environment.

Obtain the executable source files (available in the files section) and install OpenCV.

Make sure the path to the OpenCV libaries are correctly set (should be the check box during installation.)

You can set this yourself if you move the directory by right clicking My Computer and selecting properties (or hitting Win Key + Break), selecting the Advanced Tab, and hitting the Environment Variables button on the bottom. In User Variables, there should be a PATH setting, set to where the OpenCV library is installed (default is C:\Program Files\OpenCV\bin).
Open the Visual Studio 2005 environment, and open the opencv.sln solution file stored in the _make directory of your installation. (default is C:\Program Files\OpenCV\_make).

This should load the entire solution into the Visual Studio environment.
In Visual Studio, select the build file-menu, and select Build Solution.

Optional: You make choose to clean the solution before building.
Note: It takes a significant amount of time to compile the entire OpenCV library.
Enjoy your newly built OpenCV library!

 

OpenCV with G++ (on a linux system)
If you use linux, you can set up opencv there with g++ by following these steps:

Go to and download the opencv-0.9.7.tar.gz file. (Note version might change later)

As superuser, Go to the directory you downloaded the tar.gz file into. There, type tar -xzf opencv-0.9.7.tar.gzcd opencv-0.9.7./configure && make && make install Opencv should be installed. But we need to prepare g++ to work with opencv. So, go to your home directory and open the .bashrc file. Append the following to the file.

alias gcv="g++ -I/usr/local/include/opencv -lcv -lcxcore -lcvaux -lhighgui" Now, go to the opencv-0.9.7 directory from earlier, into samples, and into c, and make sure the following runs the contour program.

gcv coutours.c && ./a.out
If not, troubleshoot. If so, you should be good.

阅读(4121) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~