home | non-tech | cs | ee | about
Abstract New

OpenCV Tutorial - Getting started with OpenCV - Part 1

OpenCV is a Computer Vision programming library developed by Intel. It contains several useful routines for real time computer vision (examples - 3DTracking and Camera Calibration).

Download OpenCV from SourceForge. You need to download the beta version for Windows or Linux (based on what system you use). For windows download the executable. Run the executable and follow the instructions to install OpenCV. The SourceForge site has some documentation, which would be useful (once you get comfortable with OpenCV).

Directory Structure
Let us take a look at what we have installed so far. Navigate to "C:\Program Files\OpenCV". This is the folder containing the OpenCV files. If you don't have this folder do a search for OpenCV. If you still don't have it try installing OpenCV again. The directory should contain several subfolders:
  • The folder CV contains the header files (in the sub-folder include) that you need to include for using the Computer Vision functions available in OpenCV. The sub-folder src contains some source files that are mainly filters for performing various Image Processing, Object Tracking, Pattern Recognition and Calibration operations.
  • The folder CXCORE contains the core functions that you need if you were to write an application in OpenCV. OpenCV has a lot of data structures and these are documented in CXCORE files. Take a look at the source files in folder src.
  • The folder CVAUX contains several auxiliary functions including those used in 3D projection, HMM to mention a few.
  • The folder LIB contains all the lib files that you need to use OpenCV.
  • The folder OtherLibs contains the subfolder HighGui that contains the header files you need for using HighGUI. HighGUI is the OpenCV GUI. It provides simple methods for displaying images on screen, accepting user input etc.
Setting up the environment in Visual Studio .NET 2003
  • If you have Visual Studio .NET 2003 follow the steps to set up your environment:
  • Open Visual Studio. Click on Tools => Options => Folder Projects => VC++ Directories
  • Choose Include Files from the drop down menu and include the following paths
    • C:\Program Files\OpenCV\cxcore\include
    • C:\Program Files\OpenCV\cv\include\
    • C:\Program Files\OpenCV\cvaux\include
    • C:\Program Files\OpenCV\otherlibs\highgui
    • C:\Program Files\OpenCV\otherlibs\_graphics\include

  • Choose Library Files from the drop down menu and include the following paths
    • C:\Program Files\OpenCV\lib
    • C:\program files\OpenCV\otherlibs\_graphics\lib

  • Choose Executables from the drop down menu and include
    • C:\Program Files\OpenCV\bin

  • Create a new win32 project (You can create other types of projects as well. It is better to stick to a Win32 console project if you are new). To Create a new project File => New => Project and then select Win32 Console Project from the folder VC++ Projects
  • Give the project a suitable name. Visual Studio automatically creates a folder for your project. Click on Project =>Properties to bring up the properties menu. Click on Folder Linker => Input. In additional dependencies include the following lib files
    • cv.lib
    • highgui.lib
    • cxcore.lib
    • cxcored.lib
    • cvd.lib

  • If you don't have cxcored.lib and cvd.lib, generate them by compiling the solutions in the folder src. Note: If on running the code you get a complaint about corex096.dll (it can be corex0XX.dll) then an easy way to solve this problem is by copying the dll from the bin folder to the folder where your code resides. Alternately you can copy it to C:\WINDOWS\SYSTEM folder

No comments:

Post a Comment

© 2014 - 2015 abstract new. All rights reserved.