2010-03-31

How to Install OpenCV2.0 for Windows

As is known to us all, OpenCV has became a very popular lib for digital image or video processing purposes. http://opencv.willowgarage.com/wiki/Welcome
Here, I would like to share my experience of installing openCV2.0 in windowsXP and how to configure your C++ project in order to use openCV functions:
A: Of course, you need to download OpenCV2.0 and Cmake for windows first.
B: Run the executables and install both OpenCV and Cmake, here I installed both on my C drive.
C: Then, you open CMake GUI. In Fig.1, the red box shows where you installed OpenCV2.0 and the green box is the directory where you would like to generate OpenCV binaries: normally, you create a new folder for that, e.g. C:\openCV2.0\CV2010

Fig 1. CMake GUI

D: Then, you click on Configure first, if it is not fully successful, make sure you do all the ticks (red box in Fig.2). After configuring done, you click on Generate.
Fig.2

E: After the configuring and generating is done, you should find the items shown in Fig.3 in the folder you would like to generate OpenCV binaries (in this case, C:\OpenCV2.0\CV2010).
Fig.3 CMake generated openCV C projects

F: double click on ALL_BUILD or INSTALL.vcproj, and then press F7 to compile the project. Wait a couple of minutes for it to finish.
Fig.4 Compile OpenCV projects

G: If the compiling is successful, you should able to find all the .lib files in C:\OpenCV2.0\CV2010\lib\debug. There is also a small trick that you may need to copy all the .dll to C:\WINDOWS\system32 in order to use OpenCV without trouble :)
Fig.5 OpenCV lib files
Fig.6 Copy .dll under OpenCV folder  to C:\WINDOWS\system32

H: Last but not least, in order to use OpenCV functions properly when you create your new C project.
you need some configuration: in the project property,
Then, in C/C++ ->General ->Additional Include Directories, put
C:\OpenCV2.0\include\opencv (depends on location of OpenCV2.0)
In Linker ->Input ->Additional Dependencies, put
"C:\OpenCV2.0\CV2010\lib\debug\cv200d.lib"
"C:\OpenCV2.0\CV2010\lib\debug\cvaux200d.lib"
"C:\OpenCV2.0\CV2010\lib\debug\cvhaartraining.lib"
"C:\OpenCV2.0\CV2010\lib\debug\cxcore200d.lib"
"C:\OpenCV2.0\CV2010\lib\debug\cxts200d.lib"
"C:\OpenCV2.0\CV2010\lib\debug\highgui200d.lib"
"C:\OpenCV2.0\CV2010\lib\debug\ml200d.lib"
"C:\OpenCV2.0\CV2010\lib\debug\opencv_ffmpeg200d.lib"

Hopefully, everything should work by now and have fun with your code :)
  

1 comment:

Labels