Installing OpenCV 3.1 in Visual Studio 2015

Posted on Posted in Computer Science

In this section i will give a tutorial for installing OpenCV 3.1 in Microsoft Visual Studio 2015.

Now in the OpenCV 3.1 package is more simple than previous version such as include, static library and dynamic library. I think this tutorial will guide you easily.

First make sure you’re already installed Microsoft Visual Studio 2015.

Visual Studio 2015 will appear like this image

After that you should install opencv, you can download it from this link http://opencv.org/downloads.html. this tutorial will be applying opencv 3.1 version but you can download the latest version but i can’t guarantee this tutorial able to apply bigger than 3.1 version.

After download you should install to c:/opencv however you can install to any path but i use default path.

Back to Visual Studio, now you can create “New Project”, choose Visual C++ then Win32 and then chooose Win32 Console Application, set the project in empty project

Change the visual studio compiler to x64 because the opencv static and dynamic library now just available for x64 architecture.

After that, create new file with name “main.cpp” in Source Files you can find it at Solution Explorer

and then Right Click at your Projects and choose Properties. Now you can see the menu of  C/C++, choose it, Click additional include directories,  edit and input with “C:\opencv\build\include”

Still in project properties, now choose Linker -> General -> Additional Library Directories, choose it and input with path “C:\opencv\build\x64\vc14\lib”

and then choose Linker -> Input -> Additional Dependecies and edit and then input “opencv_world310d.lib”

now the setup is complete, you can import opencv library at your code.

Leave a Reply

Your email address will not be published. Required fields are marked *