Install OpenCV with Visual Studio Project in Windows using Pre-built binaries

Install OpenCV with Visual Studio

In this article, we will study how to install Opencv3.2.0 with Visual Studio 2015 on Windows 10. But it is almost the same for other versions. OpenCV setup with visual studio is very easy but you need to be careful when adding the binary path.

To install the OpenCV with Visual Studio Project, we can use OpenCV pre-built libraries or we can compile the latest source code (GitHub) to get the OpenCV libraries. In this article, I am going to use pre-built libraries of OpenCV to configure the visual studio.

Initial Perquisites to Install OpenCV with Visual Studio:

  • Windows-10 (64-bit)
  • Visual Studio-2015
  • Pre-built OpenCV libraries

Installation and project creation steps:

Here I have assumed that you have already installed visual studio 2015 on your computer (Windows 10 – 64 bits). Now it’s time to download the Pre-built OpenCV libraries. You can download it from SourceForge.

After downloading the “OpenCV-3.4.0-vc14_vc15.exe”, you need to double-click on it to extract the package. When you will double click on it, it asks to create the directory. Here I am creating a directory in my c drive: “C/ opencv3.2.

 

 

After the extraction of all the packages, you need to set some environment variables.

 

 

After clicking on the environment variable a popup window will be open. In popup windows, we will select the variable “path” and add the new path of the OpenCV compiler bin. The path will be relative to your created directory, here, it is  “C:\opencv3.2\opencv\build\x64\vc14\bin”.

 

Install OpenCV with Visual Studio

 

When we will click on the edit button then again a popup window will open, where we will add the compiler bin path.

 

 

Now time to create an OpenCV project, using the visual studio2015. In below Image, I am mentioning some image that describes the steps to create the new project.

 

 

After clicking the project button a popup window will open. In this window, you need to select application type win32 console and give the desired name to the project.

 

 

Now press the ok button, after pressing the ok button a popup window will open where you just only press the next button.

 

 

After pressing the next button, again a popup window will open where you will select application type console and press the finish button.

 

 

Finally, a project is created, now we need to include some required OpenCV header file and libraries. So first we need to go to project properties.

 

You can see the free trial of this video course “Getting Started with OpenCV in .NET“.

When you will click on the properties button a popup window open where you need to add the header files and required libraries.

Add the path of below header files (Below path corresponding to my created directory).

C:\opencv3.2\opencv\build\include\opencv2
C:\opencv3.2\opencv\build\include\opencv
C:\opencv3.2\opencv\build\include

 

 

Add the path of the required library which resides in OpenCV Directory.

C:\opencv3.2\opencv\build\x64\vc14\lib

 

When you will click on the additional library directories popup window open where copy the path of the library.

 

After adding the path need to write the name of the library in additional dependencies.

 

When you will click on the additional library directories popup window open where copy the path of the library.

 

Remember before building the project, we need to switch the compilation mode of visual studio X86 to X64.

 

Recommended Articles for you:

 


Leave a Reply

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