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.

相关文章推荐

How to Setup Active DataGuard on Exadata (Doc ID 1580796.1)

APPLIES TO: Oracle Exadata Storage Server Software - Version 11.2.2.3.5 to 11.2.3.2.1 [Release 11.2...

<LearnWLS> How to setup Weblogic official sample - EJB

1. Download weblogic installer from www.oracle.com 2. Install Weblogic $ sudo xhost + # incase...
  • sun_xo
  • sun_xo
  • 2017年02月04日 16:02
  • 142

How to setup linked servers for SQL Server and Oracle 64 bit client

How to setup linked servers for SQL Server and Oracle 64 bit client ProblemWe have two SQL 2005 64-b...

How To Setup Password Security? (Doc ID 564125.1)

Goal How to setup Password Security? Solution These profiles should only be set at Site level...

How To Setup a CA

From: http://pages.cs.wisc.edu/~zmiller/ca-howto/ How To Setup a CA Original Version by Ian Alde...

How to setup HTTPS [SSL] on WAMP

How to setup HTTPS SSL on WAMP Recently I had to run a website with several https links under local...

How to setup FTP server in ubuntu

File Transfer Protocol (FTP) is a TCP protocol for uploading and downloading files between computers...

How to setup java remote debugging in eclipse

How to remote debug java application in Eclipse IDE Remote debugging is not a new concept and many ...

How to setup a Mac with Python dev tools

How to setup a Mac with Python dev tools Notes for how to setup a 64-bit Mac with important Pyt...
  • WHACKW
  • WHACKW
  • 2015年04月22日 09:17
  • 806

How to Setup Xen4 and pvops 2.6.32.x on CentOS 5.5

How to Setup Xen4 and pvops 2.6.32.x on CentOS 5.5 2011-04-29 13:17 Setting up Xen4 ha...
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:How to setup OpenCV(referring to harvard university's wiki)
举报原因:
原因补充:

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