How to setup OpenCV(referring to harvard university's wiki)

转载 2006年06月19日 01:52:00

HOWTO Setup OpenCV

From RFC Cambridge Wiki

(Difference between revisions)
Revision as of 03:42, 2 February 2006
RShi (Talk | contribs)

↠Previous diff
Revision as of 03:43, 2 February 2006
RShi (Talk | contribs)
OpenCV with DevCPP
Next diff →
Line 23: Line 23:
       
  ==OpenCV with DevCPP==   ==OpenCV with DevCPP==
- OpenCV is Intel’s open source computer vision library. It contains a huge collection of computer-vision related algorithms, data structures, filters, etc. that we may find useful. + OpenCV is Intel's open source computer vision library. It contains a huge collection of computer-vision related algorithms, data structures, filters, etc. that we may find useful.
       
  Once your IDE is set up, go to http://sourceforge.net/projects/opencvlibrary/ and click on the opencv-win link   Once your IDE is set up, go to http://sourceforge.net/projects/opencvlibrary/ and click on the opencv-win link

Revision as of 03:43, 2 February 2006

Setting up OpenCV in a variety of environments.

OpenCV with V2005

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 DevCPP

OpenCV is Intel's open source computer vision library. It contains a huge collection of computer-vision related algorithms, data structures, filters, etc. that we may find useful.

Once your IDE is set up, go to http://sourceforge.net/projects/opencvlibrary/ and click on the opencv-win link

Click on the Download OpenCV Beta5 link. On the next page, choose a mirror to download

Run the setup program you just downloaded. Accept all the defaults; this will install OpenCV to C:/Program Files/OpenCV.

If you navigate to the C:/Program Files/OpenCV/samples/c directory, you will find a bunch of C/C++ code samples, showing off some of OpenCV’s capabilities. Some of them require a connected webcam to work; those won’t do anything if you open them up. You can see some examples of edge detection, erode/dilation, etc.

IMPORTANT: There is a naming problem with the latest beta5 version of openCV. Navigate to the C:/Program Files/OpenCV/bin directory. There you will find several .dll files with an 097 in them. Copy each .dll, and change the name from 097 to 096. (i.e., the copy of cv097.dll becomes cv096.dll, same for cvaux, cvcam, cxcore, and highgui) (this can be done by running copy *097.dll *096.dll under the command shell)

Add the C:/Program Files/OpenCV/bin directory and the C:/Program Files/OpenCV/otherlibs/highgui directory to your system PATH variable. This tells the computer where to find the .dll system libraries. To do this, go to Start Menu->Control Panel -> System (or hit the Windows Button + break keys). Go to the Advanced tab and click the Environmental Variables button. In the lower box, find the variable labeled PATH. Click Edit. In the lower text box, navigate to the end and append ;C:/Program Files/OpenCV/bin;C:/Program Files/OpenCV/otherlibs/highgui (remember the semicolons). Click OK in all the windows.

Open up Bloodshed Dev-C++

Go to File->Open Project or File… and open up C:/Program Files/OpenCV/samples/c/contours.c

Make a new file (File->New->Source File). Copy and paste the code from contours.c into this new file, and save it as test.cpp

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

This tells the IDE to link your program with the OpenCV libraries.

Switch to the Directories tab, and in the Libraries sub-tab add to directories:

C:/Program Files/OpenCV/lib

Switch to the C includes tab. Add

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  as include directories.

Do the same thing for the C++ includes tab.

Now you should be able to compile and run the test.cpp sample file with the command Execute->Compile and Run. This program analyzes the image of the faces to extract information about the different regions. You can change the level of the contour to see different elements of the face (eyes, pupil, nose, mouth, etc). Play around with the source code for this program; change parameters or a line of code, and see what it does. Make sure to recompile with (Execute->Compile and Run) every time you make a change.

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 http://sourceforge.net/projects/opencvlibrary/ 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.gz
cd 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.

哈佛公开课《Positive Psychology 1504》学习笔记 - Why Positive Psychology

1   Introduction: Why Positive Psychology 1.1   Why Positive Psychology 1.     The importance of f...
  • Smilings
  • Smilings
  • 2012年03月03日 21:45
  • 2679

Harvard University

09年的吧!!前一百 2009年世界大学排名 1. 美国哈佛大学 Harvard University 2. 美国斯坦福大学 Stanford University 3. 美国耶鲁大学 Yal...
  • tfy1332
  • tfy1332
  • 2013年03月20日 22:07
  • 557

How to setup Wiki on CentOS

http://blog.javachap.com/index.php/installing-mediawiki-on-linux-centos/ http://blog.sina.com.cn/s/...
  • princess9
  • princess9
  • 2012年11月15日 15:12
  • 533

Oprah's speech at Harvard

For many students and their families, this time of year marks a momentous rite of passage—it's gradu...
  • u010818126
  • u010818126
  • 2013年06月17日 11:25
  • 457

关于OpenCV的介绍(摘自OpenCV官方wiki主页)

Intel® 开源计算机视觉库OpenCV什么是OpenCVOpenCV是Intel®开源计算机视觉库。它由一系列 C 函数和少量 C++ 类构成,实现了图像处理和计算机视觉方面的很多通用算法。 重要...
  • tianrolin
  • tianrolin
  • 2006年06月19日 19:15
  • 1823

How to Setup a Linux Firewall with PPPoE/NAT/iptables

PPPoE for Linux Many Internet service providers are using the Point-to-Point Protocol over Ethernet ...
  • mephp
  • mephp
  • 2009年12月09日 01:58
  • 2635

How to install eclipse on linux

1. Downloadeclipse tar package.    Download eclipse juno from eclipse's homepage to a folder.   2...
  • williamcs
  • williamcs
  • 2013年02月13日 14:35
  • 699

UVA11038 How Many O's?题解

原文链接:http://www.algorithmist.com/index.php/User:Sweepline/UVa_11038.cpp AC的C++语言程序如下: // C++...
  • tigerisland45
  • tigerisland45
  • 2018年01月16日 22:06
  • 92

UVA11038- How Many O's?(组合数学)

题目链接 题意:求出在a到b之间的数中,有多少个0。 思路:组合数学问题。可以枚举每个位置上的数i,假设i之前的数为left,后面的为right,后面有num位数。当i != ...
  • u011345461
  • u011345461
  • 2014年09月17日 10:30
  • 875

UVa-11038 How Many O's? (整数区间分解)

这类题大的方向都是写一个函数f(n)表示1到n中所有的数一共有多少个0,那么最终的答案就是f(n)-f(m-1)所以关键就是如何写f,这是一个神奇的方法。。。 首先比如n=12345,把其中一位数假设...
  • GrimCake
  • GrimCake
  • 2017年02月22日 22:23
  • 197
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How to setup OpenCV(referring to harvard university's wiki)
举报原因:
原因补充:

(最多只允许输入30个字)