Ads 468x60px

Tuesday, April 10, 2012

Setting OpenCV 2.3.1 on VS2008 and 2010

Hi all

       This is a simple tutorial for setting Opencv 2.3.1 library on Windows 7 .

Procedure :
  • Download Visual c++  2008 Express Edition through web-install 

  • Install Opencv 2.3.1 into C:\ProgramFiles
  • OpenVisual c++ and create an empty project .

  • Add a cpp file for Coding :
  • Right click on Sourcefile->Add->Newitem .Select .cpp and give a name to cpp file

  • Setup Include Dir and Link folders as per screenshots
Switch to Release Mode as shown in fig

Include Directory Setup

Link Directory setup

Note:Diffrence between VS2008 and 2010 is in this step only
You need to replace vc9 with vc10 .

Additional Dependencies

Simple code to try 

#include "opencv2/highgui/highgui.hpp"
#include <iostream>
#include <stdio.h>

using namespace std;
using namespace cv;

int main(int argc,
char *argv[]

Mat image;
image=imread("C:\\Users\\Public\\Pictures\\Sample Pictures\\Jellyfish.jpg",1);

return 0;

Press F5 to build and run program or F7 to build program only

Sample code download



Anonymous said...

Danke fuer diese Anleitung.
Umgebungsvariable: den Pfad fuer die .dll's hinzufuegen

Anonymous said...

Please add this path for .dll's into your tutorial. When trying i got Error because of missing core231.dll ...
But instead of this missing dll. Its realy the best tut for setting opencv on vs. Thank you!

Unknown said...

i also encountere a missing opencv_core246.dll how to fix it?

Lentin Joseph said...


I think you are using opencv 2.4.6 , but the current tutorial tells about setting opencv 2.3.1,so dll will be diffrent. i think you need to set an environmental variable of the .dll path.

Unknown said...

Lentin Joseph

yes i am using opncv246. how do i set the path for the dll?

Unknown said...

the program above already worked... but the second one.

"How to do OpenCV haar-training in Windows 7"

still breaks...i really need help....

Lentin Joseph said...

Hi Michael

Are you trying to build ObjectMarker.cpp now? Actually try to understand the procedures of setting a opencv library path on visual studio first. Then set into an empty project like i do. Please dont depend on test project that i given.

Then try to build object marker.cpp as mentioned in training post. I think you can start with a fresh project rather than test project.

Anonymous said...

i am getting error core231.dll missing?
what to do?

Unknown said...

Thanks very much for this clear content! I was using a version OpenCV version 2.4.3 for a time and one could make this work also with MSVC++ Express 2010 by simplifying the include directory setup shown by simply inputting C:\Program Files\OpenCV2.4.3\build\include and that's it. This assumes that OpenCV 2.4.3 is installed in /Program Files when using x64 system.

Post a Comment