Hangvirus Search


Installation of Opencv in MS - Visual C++


Install OpenCV

Download OpenCV installer and install it. I assume you have installed onto C:\Program Files\OpenCV.
It is being assumed that you know the usage of Microsoft Visual C++, such as creating projects and their properties.
MS Visual C++

Setup MS Visual C++

I write details based on MS Visual Studio 2005. Follow menus of MS Visual C++ window as:
  • Tools > Options > Projects and Solutions > VC++ directories >
  • Show Directory for: > Include Files. Now add

    C:\Program Files\OpenCV\cv\include
    C:\Program Files\OpenCV\cvaux\include
    C:\Program Files\OpenCV\cxcore\include
    C:\Program Files\OpenCV\otherlibs\highgui
    C:\Program Files\OpenCV\ml\include
    C:\Program Files\OpenCV\otherlibs\cvcam\include
  • Show Directory for: > Library Files. Now add

    C:\Program Files\OpenCV\lib
  • (Option) Show Directory for: > Source Files. Now add

    C:\Program Files\OpenCV\cv\src
    C:\Program Files\OpenCV\cvaux\src
    C:\Program Files\OpenCV\cxcore\src
    C:\Program Files\OpenCV\otherlibs\highgui
    C:\Program Files\OpenCV\otherlibs\cvcam\src\windows

Setup MS Visual C++ for each project

  • Right Click Project > Property >
  • Configuration Proeperties > Linker > Input > Additional Dependencies. Now add

    • cv.lib cxcore.lib cvaux.lib highgui.lib ml.lib cvcam.lib
  • Change 'Configuration' drop down menu from Release (Debug) to Debug (Release).
  • Do the same thing (Add .libs to Input)
Or, add below codes into your source codes above #include(s).

#ifdef _MSC_VER
#pragma comment(lib, "cv.lib")
#pragma comment(lib, "cxcore.lib")
#pragma comment(lib, "cvaux.lib")
#pragma comment(lib, "highgui.lib")
#pragma comment(lib, "ml.lib")
#pragma comment(lib, "cvcam.lib")


For examples see the opnecv samples in the the folder created during setup.
Try them on the Microsoft Visual C++ 2008 projects.

0 comments to "Installation of Opencv in MS - Visual C++"

Post a Comment

Ads -

About This Blog

the blog is here to update the various aspects and the new touch to the virgin horizons of the human developed technology. it is a technology blog providing tips and tricks of computers, updates about gadgets, new games, tutorials and all that a rookie computer man would expect




Subscribe in a reader
Subscribe via E-mail :

Enter your email address:

IndiBlogger - The Indian Blogger Community
Subscribe Us via SMS in INDIA
sms - ' ON hangvirus ' to 9870807070

Software Engineering

Google Groups
Subscribe to software-engineering2010
Visit this group


Join This Blog