Step 1:
Download OpenCV-2.3.0-win-superpack.exe from http://sourceforge.net/projects/opencvlibrary/files/opencv-win/2.3/
Run OpenCV-2.3.0-win-superpack.exe and copy the generated folder OpenCV2.3 to C drive
Step 2:
Open Microsoft Visual Studio 2008 and click Tools->Options

Select Projects and Solutions and then VC++ Directories. Select Include files in Show directories for: drop down menu. Add the following paths.
C:\OpenCV2.3\opencv\include\opencv
C:\OpenCV2.3\build\include

Select Library files in Show directories for: drop down menu. Add the following path.
C:\OpenCV2.3\build\x86\vc9\lib
Now we have added include and library file paths and this need to be done only for the first time.
Step 3:
Create an new project in Visual Studio 2008
Click Project->Properties. Select Configuration Properties -> Linker -> Input. Make sure you select Debug in ‘Configuration:’ drop down menu and then add the following to the Additional Dependencies.
opencv_features2d230d.lib opencv_highgui230d.lib opencv_core230d.lib opencv_imgproc230d.lib opencv_ml230d.lib opencv_objdetect230d.lib opencv_video230d.lib opencv_contrib230d.lib opencv_calib3d230d.lib
Now select Release in ‘Configuration:’ drop down menu and then add the following to the Additional Dependencies and click OK
opencv_features2d230.lib opencv_highgui230.lib opencv_core230.lib opencv_imgproc230.lib opencv_ml230.lib opencv_objdetect230.lib opencv_video230.lib opencv_contrib230.lib opencv_calib3d230.lib


Step 4:
Add C:\OpenCV2.3\build\x86\vc9\bin to the environment path as shown in screenshot below. You may need to restart the system after setting this.

To test whether the OpenCV is working, add a C++ file under Source files as shown in screen shots below.


Copy the sample program given below and build it and run. An image will be displayed in a window.
01.#include <cv.h>02.03.#include <highgui.h>04.05.using namespace cv;06.07.int main()08.09.{10.11.namedWindow("wnd");12.13.Mat img;14.15.img= imread("C://Users//Public//Pictures//Sample Pictures//Desert.JPG"); //image path16.17.imshow("wnd",img);18.19.cvWaitKey();20.21.return 0;22.23.}For OpenCV 2.3.1, the only change is in step 3. Add the library files accordingly as shown below.
In debug mode
opencv_features2d231d.lib opencv_highgui231d.lib opencv_core231d.lib opencv_imgproc231d.lib opencv_ml231d.lib opencv_objdetect231d.lib opencv_video231d.lib opencv_contrib231d.lib opencv_calib3d231d.lib
In release mode
opencv_features2d231.lib opencv_highgui231.lib opencv_core231.lib opencv_imgproc231.lib opencv_ml231.lib opencv_objdetect231.lib opencv_video231.lib opencv_contrib231.lib opencv_calib3d231.lib