[batches from http://opencv-srf.blogspot.jp/]
- Visual Studio: https://www.visualstudio.com/ (I used VS Express 2013)
- OpenCV package: http://sourceforge.net/projects/opencvlibrary/files/opencv-win/ (I used opencv 2.4.11)
- Unzip opencv directly into C:\. Example: C:/opencv2411/…
- My Computer > See operating system (x32/86 or x64)
- My Computer > System Settings (toolbar) > Advanced System Settings > Environment Variables > System variables
- Select PATH and click Edit…
- Add at the end the path for opencv:
- vc10, vc11, vc12… are different versions of opencv. Make sure your version is compatible with Visual Studio. For instance, Visual Express 2013 is compatible with all three of them in this case.
CONFIGURE VISUAL STUDIO
First off, install Visual Studio. Then, create new C++ win32 console empty project.
Inside the Solution Explorer, where our project directory tree is, right click on the title of the project and go to Properties. If your system is x64, go to Configuration Manager… (top right). Inside this window, create a x64 active platform copied from/including win32. Sounds weird, just look around until you realize what I mean. Then set your project’s “Platform” to x64 and move on.
Inside Configuration Properties > C/C++ > General > Additional Include Directories: edit there and include this:
Inside Configuration Properties > Linker > General > Additional Library Directories: edit there and add the following:
Inside Linker > Input > Additional Dependencies, you must add all .lib files contained inside C:\opencv2411\build\x64\vc12\lib. The ones ending in …d.lib refer to the Debug mode, while the others refer to the Release mode. Make sure to at least include the Debug mode ones, if not all of them. In the case of opencv2.4.11 these files are:
That’s it! You are all set. You can try implementing some quick opencv functions like this one to see if everything works OK.
*Note: tutorials include a new variable called OPENCV_DIR or OPENCV_BUILD in system variables, and then use it everytime they have to call a path. While this helps in case of moving the main folder (you only need to modify one line, this variable, and everything else is automatically updated), this has been the cause of errors every time I tried installing it; so I recommend against.