# Install opencv Visual Studio 2015

> Build OpenCV 3 from source for Visual Studio 2015, third-party libs included, for when no prebuilt VC14 binaries have been released yet.

- Canonical URL: https://www.funvisiontutorials.com/blog/install-opencv-visual-studio-2015/
- Author: Vladimir Kucera
- Published: 2015-11-21
- Updated: 2023-09-13
- Topics: Installing & building OpenCV

Opencv tutorial on how to build OpenCV from source in Visual Studio 2015. This is useful when the new version has just been released and there is no prebuild library available.  If you download prebuild libs for Windows Visual Studio times again there is a problem with the newest VS just mussing. Let's check the version of libraries and VS.

Prebuild libs are only for versions VC11 and VC12. This means Visual Studio 2012 and 2013.

This step helps you compile your own opencv libs for VC14  - [Visual Studio](http://www.amazon.com/Professional-Visual-Studio-Bruce-Johnson/dp/1119068053/ref=as_li_bk_tl/?tag=computevision-20&linkId=dee0234397ffb480a232dffcffd83489&linkCode=ktl) 2015 Community edition.

Important !!
Nowadays just use NUGET packages in Visual Studio and you can code in under 1 minute. [here](/blog/opencv-31-opencv-2413-instalation-visual-studio/).

## Prepare third-party libs for opencv

This step depends on your requirements. If you want Python lets install Python. But I can recommend installing the following parts.

-   [Intel © Threading Building Blocks (_TBB_)](http://threadingbuildingblocks.org/file.php?fid=77)
-   [Intel © Integrated Performance Primitives (_IPP_)](http://software.intel.com/en-us/articles/intel-ipp/)
-   [http://www.ffmpeg.org](http://www.ffmpeg.org/)

## Build opencv 3.0.0

Download Opencv 3.0.0 gold

-   [https://github.com/Itseez/opencv/releases](https://github.com/Itseez/opencv/releases)

-   Extract files folder into C:/opencv-3.0.0

-   Prepare Empty folder C:/opencv-build

### Build your own OPENCV by CMAKE and VISUAL STUDIO.

#### Prepare Solution

-   install CMAKE

CMake is an extensible, open-source system that manages the build process in an operating system.
With this program, you generate a visual studio Opencv.sln solution file.

[https://cmake.org/download/](https://cmake.org/download/)

Choose windows installer

Windows (Win32 Installer)
[cmake-3.4.0-win32-x86.exe](https://cmake.org/files/v3.4/cmake-3.4.0-win32-x86.exe)

#### Run Cmake

cmake-gui.exe

[Image: cmake opencv]

_cmake-gui_

**Set field**\-

-    Where is the source code?  C:/opencv-3.0.0   (downloaded from git)
-    Where to build the binaries C:/opencv-build   (the empty folder you create)

**Select configure button**

-   Choose Visual Studio 14 2015    Win64 bits of 32 as you like.
-   I am using default native compiler options.
-   Hit a Finish button

In the table name- Choose the components you want to install. Just try the default first,

**Now press the Generate button an with,**

This process takes some time and copies files and generates a Visual Studio OpenCV.sln file in the **C:/opencv-build** folder.

## Build and release Opencv 3.0.0 in [Visual Studio 2015](http://www.amazon.com/Visual-Studio-2015-For-Beginners/dp/1519787707/ref=as_li_bk_tl/?tag=computevision-20&linkId=d1d9d82d3071a3c6b470739168428629&linkCode=ktl)

-   Open Visual Studio 2015
-   By file-open-project choose **OpenCV.sln** in **C:/opencv-build**
-   **Visual Studio open this project structure.**

[Image: Build opencv Visual Studio 2015]

-   Choose Debug and green start.
-   After that choose Release and press green start.

[Image: Opencv 3 visual studio 2015]

This build and release process can generate some errors.
**Look at the details. All these errors in my case are in performance test parts.**

-   **Ok  Some errors but in test parts. I don't care. Let's install OpenCV.**

[Image: Install opencv Visual Studio 2015]

## Install [Opencv](http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134/ref=as_li_bk_tl/?tag=computevision-20&linkId=331f09c6c1b500cf89697e00a8945e49&linkCode=ktl), Windows 7, [Windows](http://www.amazon.com/Microsoft-Windows-System-Builder-Disc/dp/B00ZSHDJ4O/ref=as_li_bk_tl/?tag=computevision-20&linkId=33406c62a3cdf9e91905f49812f630ba&linkCode=ktl) 10, Visual Studio 2015

### Visual Studio 2015 64-bit version

In case you open your build folder before this step and you can't find Opencv Libs and Headers.

You need to do the following.

-   Choose an **INSTALL** project in the visual studio like in the picture.
-   **Build Release only this install project**

[Image: Install opencv Visual Studio 2015]

_Install your project_

The result is 1 successfully built solution and 0 failed as in the picture.

#### Your installation of opencv is c:/opencv-build/install

There is your header and libs for Visual Studio 2015.

**I have got only the x64 version.**

## Test Opencv Visual Studio 2015

### Include Project in Visual Studio.

Choose the Property pages of the project.

C\\C++

    General

         Additional Include Directory as C:\\opencv-build\\install\\include

         Additional #using Directory as C:\\opencv-build\\install\\include

Linker

      General

         Additional Library Directories as C:\\opencv-build\\install\\x64\\vc14\\lib

Linker

       Input

          Additional Dependencies add some libs like

         opencv\_core300.lib

         opencv\_highgui300.lib

         opencv\_imgcodecs300.lib

         opencv\_imgproc300.lib

And you can build your Opencv program. You can copy mine from the image but choose your picture.

[[Image: Opencv 3.0.0 Visual Studio 2015]](http://www.amazon.com/Learning-OpenCV-Computer-Vision-Library/dp/0596516134/ref=as_li_bk_ia/?tag=computevision-20&linkId=4e65eb3a7495479a411b379b97711c72&linkCode=kia)
