วันจันทร์ที่ 15 เมษายน พ.ศ. 2556

install opencv with visual studio 2012 credit by Hongbo Miao


Using OpenCV 2.45 in Vsiual Studio 2012


First

Open Windows Explorer. Click on Computer and then System properties.
image description
Choose Advanced system settings.
image description
Click Environment Variables...
image description
Add only this to Environment Variables -> System variables -> Path
C:\OpenCV\build\x64\vc11\bin
image description
image description

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.
image description

Third

For Release:

View -> Property Manager
Double click Release | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  • Linker -> Input -> Additional Dependencies
opencv_calib3d245.lib
opencv_contrib245.lib
opencv_core245.lib
opencv_features2d245.lib
opencv_flann245.lib
opencv_gpu245.lib
opencv_haartraining_engine.lib
opencv_highgui245.lib
opencv_imgproc245.lib
opencv_legacy245.lib
opencv_ml245.lib
opencv_nonfree245.lib
opencv_objdetect245.lib
opencv_photo245.lib
opencv_stitching245.lib
opencv_ts245.lib
opencv_video245.lib
opencv_videostab245.lib

For Debug:

View -> Property Manager
Double click Debug | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  1. Linker -> Input -> Additional Dependencies
opencv_calib3d245d.lib
opencv_contrib245d.lib
opencv_core245d.lib
opencv_features2d245d.lib
opencv_flann245d.lib
opencv_gpu245d.lib
opencv_haartraining_engined.lib
opencv_highgui245d.lib
opencv_imgproc245d.lib
opencv_legacy245d.lib
opencv_ml2445.lib
opencv_nonfree245d.lib
opencv_objdetect245d.lib
opencv_photo245d.lib
opencv_stitching245d.lib
opencv_ts245d.lib
opencv_video245d.lib
opencv_videostab245d.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.
image description
Choose Visual Studio 11 Win64. Click Finish.
image description
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.
image description
Right click INSTALL. And choose Build.
image description
After a long period of time, go back and choose Release. Similarly, right click INSTALL. And chooseBuild.

Note: If you have a problem during install build you have to make clean and build it again. 
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.
image description
Choose Advanced system settings.
image description
Click Environment Variables...
image description
Add only this to Environment Variables -> System variables -> Path
C:\OpenCV\install\bin
image description
image description

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.
image description

Fourth

For Release:

View -> Property Manager
Double click Release | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  1. Linker -> Input -> Additional Dependencies
opencv_calib3d245.lib
opencv_contrib245.lib
opencv_core245.lib
opencv_features2d245.lib
opencv_flann245.lib
opencv_gpu245.lib
opencv_haartraining_engine.lib
opencv_highgui245.lib
opencv_imgproc245.lib
opencv_legacy245.lib
opencv_ml245.lib
opencv_nonfree245.lib
opencv_objdetect245.lib
opencv_photo245.lib
opencv_stitching245.lib
opencv_ts245.lib
opencv_video245.lib
opencv_videostab245.lib

For Debug:

View -> Property Manager
Double click Debug | x64
  1. C/C++ -> General -> Additional Include Directories
C:\OpenCV\build\include\opencv
C:\OpenCV\build\include
  1. Linker -> General -> Additional Library Directories
C:\OpenCV\build\x64\vc11\lib
  1. Linker -> Input -> Additional Dependencies
opencv_calib3d245d.lib
opencv_contrib245d.lib
opencv_core245d.lib
opencv_features2d245d.lib
opencv_flann245d.lib
opencv_gpu245d.lib
opencv_haartraining_engined.lib
opencv_highgui245d.lib
opencv_imgproc245d.lib
opencv_legacy245d.lib
opencv_ml245d.lib
opencv_nonfree245d.lib
opencv_objdetect245d.lib
opencv_photo245d.lib
opencv_stitching245d.lib
opencv_ts245d.lib
opencv_video245d.lib
opencv_videostab245d.lib
Note the file names has extra "d" which means debug



http://answers.opencv.org/question/6495/visual-studio-2012-and-rtlfreeheap-error/#6603 << Thank you so much