Download OpenCV 3.1
Download VS2010
Download CMake 3.2.0
I assume you‘ve already installed VS2010 and CMake 3.2.0 correctly.
Compile the OpenCV:
Start CMake 3.2.0, fill the source and destination:
source: C:/opencv3.1/sources
destination: C:/opencv3.1/VS2010
Click Configure and use Visual Studio 10 2010 to complie.
When first configure is done, select Grouped and Advanced.
CMAKE_INSTALL_PREFIX [C:/opencv3.1/VS2010_install]
Check WITH_QT, WITH_OPENGL, WITH_OPENNI2 or any other you think necessary.
click Configure again.
After configure is done (No errors show), click Generate.
Go back to your build folder, open OpenCV.sln, right click ALL_BUILD, choose Rebuild.
Wait a long time for make process, have a cup of coffee :)
After rebuild is done, right click INSTALL, choose Build.
Now, the configuration is done, enjoy it :)
Add in the system Path:
C:\opencv3.1\VS2010_install\x86\vc10\bin
Create a new empty project,
Project->Project Property->Configuration Properties->VC++Directories ->Include Directories:
C:\opencv3.1\VS2010_install\include
C:\opencv3.1\VS2010_install\include\opencv
C:\opencv3.1\VS2010_install\include\opencv2
Project->Project Property->Configuration Properties->VC++Directories ->Library Directories:
C:\opencv3.1\VS2010_install\x86\vc10\lib
Project->Project Property->Configuration Properties->Linker->Input: (Release Mode)
opencv_calib3d310.lib
opencv_core310.lib
opencv_features2d310.lib
opencv_flann310.lib
opencv_highgui310.lib
opencv_imgcodecs310.lib
opencv_imgproc310.lib
opencv_ml310.lib
opencv_objdetect310.lib
opencv_photo310.lib
opencv_shape310.lib
opencv_stitching310.lib
opencv_superres310.lib
opencv_ts310.lib
opencv_video310.lib
opencv_videoio310.lib
opencv_videostab310.lib
opencv_viz310.lib