Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here is how I installed it, be advised you need CMake and Visual Studio 2008 for this installation:

Extract the OpenCV files to a simple directory like: C:\OpenCV243 (that's what I use) Assuming you extracted the files to C:\OpenCV243 directory;

  • There should be a folder called "opencv" inside C:\OpenCV243, Copy everything inside the "opencv" folder to C:\OpenCV243 and delete the "opencv" folder.

  • Run CMAKE and type C:\OpenCV243 to source code box and type C:\OpenCV243\cnf to build the binaries part. It will ask you if you want to create a folder called "C:\OpenCV243\cnf" click yes.

  • It will then ask you which ide you want to use for building the solution with, select VS 9 2008.

  • It will list all of the projects etc. select the ones you want to build in a solution. Make sure you select the box "Install C Examples" to get the sample codes which are VERY helpful.

  • First Configure and then Generate.

  • Now you should find a file called "OpenCV.sln" in C:\OpenCV243\cnf. Open this file and build it in Debug configuration. And then build it in Release configuration.

  • There are 2 folders under the C:\OpenCV243\cnf directory called "lib" and "bin". Copy those to C:\OpenCV243 directory.

  • Copy folders under C:\OpenCV243\build\include to C:\OpenCV243\include

  • Copy the dll files in C:\OpenCV243\bin\Release and C:\OpenCV243\bin\Debug to C:\Windows\System32

  • Right Click on Computer, Select Properties and then click on "Advanced System Settings", Click on environment variables, add a new environment variable called PATH and add those directories to that variable: C:\OpenCV243\bin\Debug;C:\OpenCV243\bin\Release;C:\OpenCV243\bin NOTE: You might not need this as you already copied dll files but I would still do it anyway.

  • Now open VS 9 2008 and create a new windows 32 console application.

  • Go to Tools-->Options-->Project and Solutions On the right corner you should see a box titled "Show the directories for" Select Include files and add C:\OpenCV243\include, C:\OpenCV243\include\opencv, C:\OpenCV243\include\opencv2

  • Select "Library" under the same menu ("show directories for") and add C:\OpenCV243\lib\Debug C:\OpenCV243\lib\Release

  • Select "Executable Files" and add the $PATH to the list. Save and close the options window

  • Right click on the project and select "Properties", Go to Linker-->Input and while in Debug configuration add following libraries: opencv_calib3d243d.lib opencv_contrib243d.lib opencv_core243d.lib opencv_features2d243d.lib opencv_flann243d.lib opencv_gpu243d.lib opencv_haartraining_engined.lib opencv_highgui243d.lib opencv_imgproc243d.lib opencv_legacy243d.lib opencv_ml243d.lib opencv_nonfree243d.lib opencv_objdetect243d.lib opencv_photo243d.lib opencv_stitching243d.lib opencv_ts243d.lib opencv_video243d.lib opencv_videostab243d.lib

switch to Release configuration and add following libraries--> opencv_calib3d243.lib opencv_contrib243.lib opencv_core243.lib opencv_features2d243.lib opencv_flann243.lib opencv_gpu243.lib opencv_haartraining_engine.lib opencv_highgui243.lib opencv_imgproc243.lib opencv_legacy243.lib opencv_ml243.lib opencv_nonfree243.lib opencv_objdetect243.lib opencv_photo243.lib opencv_stitching243.lib opencv_ts243.lib opencv_video243.lib opencv_videostab243.lib

Note that you might not need all those libraries for your project but better be safe than sorry. When you learn which library does what, you can simply include those libraries in your project.

OpenCV should work now, try loading an image to check. This is how I installed it. Note that there may be unnecessary steps there, but I'm a newbie too and I didn't wanna mess up while installing so this is how I installed it.