Note: This is a tutorial for using OpenCV 2.44 and OpenCV 2.43 in Vsiual Studio 2012. If you use old OpenCV 2.43, please skip over the part for OpenCV 2.44.
Using OpenCV 2.44 in Vsiual Studio 2012
First
Open Windows Explorer. Click on Computer and then System properties.
Choose Advanced system settings.
Click Environment Variables...
Add only this to Environment Variables -> System variables -> Path
C:\OpenCV\build\x64\vc11\bin
Second
After creating your own project in Visual Studio 2012...
Build menu -> Configuration Manager
Change the Active solution platform. Click on Win32, Select New.... Use the settings below and click OK.
Third
For Release:
View -> Property Manager
Double click Release | x64
- C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
- Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
- Linker -> Input -> Additional Dependencies
opencv_calib3d244.lib
opencv_contrib244.lib
opencv_core244.lib
opencv_features2d244.lib
opencv_flann244.lib
opencv_gpu244.lib
opencv_haartraining_engine.lib
opencv_highgui244.lib
opencv_imgproc244.lib
opencv_legacy244.lib
opencv_ml244.lib
opencv_nonfree244.lib
opencv_objdetect244.lib
opencv_photo244.lib
opencv_stitching244.lib
opencv_ts244.lib
opencv_video244.lib
opencv_videostab244.lib
For Debug:
View -> Property Manager
Double click Debug | x64
- C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
- Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
- Linker -> Input -> Additional Dependencies
opencv_calib3d244d.lib
opencv_contrib244d.lib
opencv_core244d.lib
opencv_features2d244d.lib
opencv_flann244d.lib
opencv_gpu244d.lib
opencv_haartraining_engined.lib
opencv_highgui244d.lib
opencv_imgproc244d.lib
opencv_legacy244d.lib
opencv_ml244d.lib
opencv_nonfree244d.lib
opencv_objdetect244d.lib
opencv_photo244d.lib
opencv_stitching244d.lib
opencv_ts244d.lib
opencv_video244d.lib
opencv_videostab244d.lib
Note the file names has extra "d" which means debug
Using OpenCV 2.43 in Vsiual Studio 2012
First
Download CMake. Open CMake and use settings below. Then click Configure.
Choose Visual Studio 11 Win64. Click Finish.
After a while, click Configure again. Wait a moment and then click Generate.
Close CMake and go to C:\MyOpenCV, open OpenCV.sln.
Choose Debug.
Right click INSTALL. And choose Build.
After a long period of time, go back and choose Release. Similarly, right click INSTALL. And choose Build.
Close Visual Studio 2012.
Copy C:\MyOpenCV\install folder to C:\OpenCV.
So now you have a C:\OpenCV\install folder. You can delete C:\MyOpenCV whole folder if you want.
Second
Open Windows Explorer. Click on Computer and then System properties.
Choose Advanced system settings.
Click Environment Variables...
Add only this to Environment Variables -> System variables -> Path
C:\OpenCV\install\bin
Third
After creating your own project in Visual Studio 2012...
Build menu -> Configuration Manager
Change the Active solution platform. Click on Win32, Select New.... Use the settings below and click OK.
Fourth
For Release:
View -> Property Manager
Double click Release | x64
- C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
- Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc10\lib
- Linker -> Input -> Additional Dependencies
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 ...
(more)