In this tutorial I will show you we can install OpenCV on Windows for C++ and Python
Visual Studio Community 2019 could be downloaded from https://www.visualstudio.com/downloads/. During a fresh installation enable "Desktop development with C++" workload and check box "Windows 10 SDK" to enable usage of the Graphical Device Interface (GDI) useful to display images in a window thanks to vpDisplayGDI class. After a fresh installation, start Visual Studio and create an empty C++ project to install the common tools for Visual C++ 2019.
If you already have Visual Studio Community 2019, you can check if "Desktop Development with C++" workload is activated and if "Windows 10 SDK" is enabled following instructions given here that we resume: 1.1 Find the Visual Studio Installer on your computer. Select Start, and then scroll to the letter V, where it's listed as Visual Studio Installer Click or tap to start the installer, and then choose "Modify" 1.2 From the Workloads screen, check if "Desktop Development with C++" workload is activated and if "Windows 10 SDK" is enabled like in the following image
1.3 Choose Modify again. 1.4 After the new workloads and components are installed, choose Launch.
Once you have set up Visual Studio on your system, download the installer according to the Visual Studio version you have installed.
OpenCV Version | Visual Studio 16 | Visual Studio 15 | Visual Studio 14 |
---|---|---|---|
OpenCV-4.5.1 | OpenCV-4.5.1-vc16.exe | OpenCV-4.5.1-vc15.exe | OpenCV-4.5.1-vc14.exe |
OpenCV-4.5.0 | OpenCV-4.5.0-vc16.exe | OpenCV-4.5.0-vc15.exe | OpenCV-4.5.0-vc14.exe |
OpenCV-4.4.0 | OpenCV-4.4.0-vc16.exe | OpenCV-4.4.0-vc15.exe | OpenCV-4.4.0-vc14.exe |
OpenCV-4.1.0 | OpenCV-4.1.0-vc16.exe | OpenCV-4.1.0-vc15.exe | OpenCV-4.1.0-vc14.exe |
Once you download the installer, double click it to run the installer. Before the installer starts, it’ll ask you permission to run the executable. Click on More info and then on Run anyway. Click on "More Info" to get the option to run the Installer Click on "Run anyway" to run the Installer Read the license and If you accept it, click on I accept the agreement and click on Next. Next, it’ll ask you to choose the installation folder. You can install OpenCV anywhere on the system. The default location is C:. Finally, the installer will ask you for confirmation to install OpenCV on the system. Click on Install to continue. Confirm Install After OpenCV is installed, you can exit the installer.