Join the waitlist to receive a 20% discount
Courses are (a little) oversubscribed and we apologize for your enrollment delay. As an apology, you will receive a 20% discount on all waitlist course purchases. Current wait time will be sent to you in the confirmation email. Thank you!
What best describes you?
Which of these are you most comfortable with:
OpenCV 4.8.1
OpenCV 4.8.1 has been released.
🛠️ Change log is here.
SHA256 sum for packages:
a8bfe53cf9d7fa94ed5d85d61cf028348a6a1268b8027c9bc95ca96edd90ba13 opencv-4.8.1-android-sdk.zip
0689312a9de439757618a412b266dc5ee75d2e32aefa9eac32c3f808ade06331 opencv-4.8.1-ios-framework.zip
037dd1c5c172237b0a00ee822684e5ac453028e1933111a2c547b62061f8b7e4 opencv-4.8.1-windows.exe
OpenCV 4.8.0
OpenCV 4.8.0 has been released.
🛠️ Change log is here.
SHA256 sum for packages:
e415d976549be7aa56a909cedb7d9b5b7fd24dbdd0eabee94de0f004c52ddc7c opencv-4.8.0-android-sdk.zip
89c33d2b0a66b287ffc7a7643bfed4ae4a0728a76a5c4c852854efdb300693b3 opencv-4.8.0-ios-framework.zip
1c8b1b78a51c46852eb5569d762bd11d0097a45c3db1f03eb41aba6f727b8942 opencv-4.8.0-windows.exe
8e7ea70b52ce28b521367368cdadfc8457b36046dcbc5c3ed83d094edb6e35d9 opencv-4.8.0-docs.zip
OpenCV 4.7.0
OpenCV 4.7.0 has been released.
🛠️ Change log is here.
SHA256 sum for packages:
078ec6d99b39b3974d60508af1f1e64ef1134128399e6268e1cf86d00b10a77c opencv-4.7.0-android-sdk.zip
c23e92c4a0cd343f73d4056e66c961cdf68e73ca699b1129638537a931c4ffc8 opencv-4.7.0-ios-framework.zip
7fab7be68a4ab7f1b70759b0e58d4c4ffc2b8aee72642df6f2dfcc6c161b2465 opencv-4.7.0-windows.exe
576da5deea65283bd614564de4973594e2f629b6909cb589de5948e326f49075 opencv-docs-4.7.0.zip
UPDATE: iOS framework package and checksum were updated after CI issue fix.
OpenCV 4.6.0
OpenCV 4.6.0 has been released.
🛠️ Change log is here.
sha256 sums for packages:
b1f0002af4792866edbfde6a85346deb78a79c68b019f2d6f13cee7e08cef0aa opencv-4.6.0-android-sdk.zip
b363dbf9d775afe2e31967d3b2041a0f1efcde6647ce0121422c2dfb64f1ce5b opencv-4.6.0-docs.zip
e4dc3e29d490c64e39aeaf61661635790232ba646656e6603dfe12786f36ab93 opencv-4.6.0-ios-framework.zip
3fb046e14dc5b50719a86ea0395b5b1e3299e2343111ebd2e31828aa31d6d477 opencv-4.6.0-vc14_vc15.exe
All changes: 4.5.5…4.6.0
OpenCV 4.5.5
OpenCV 4.5.5 has been released.
🛠️ Change log is here.
sha256 sums for packages:
404e5a04b2f01833a208857eb192c88f33fdfc66f827ac2a993e4581849b2d08 opencv-4.5.5-android-sdk.zip
d77309dbe2bb883b93631810b10c2df502bd656fc93c691f4949d9451b5acae1 opencv-4.5.5-docs.zip
60d4d44aac22a4ca8de069fc43d218e3dad777e440e69f8bd7ca2be635c3bde1 opencv-4.5.5-ios-framework.zip
f76c83db33815ce27144c6b20ed37e8f0b4ae199ad9b3a0291ccfcf7b0fb2703 opencv-4.5.5-openvino-dldt-2021.4.2-vc16-avx2.7z
97832b7c89e9d5171c2b7637afe99df5567a3b766ed55a5d7d80a08d6937f2b0 opencv-4.5.5-openvino-dldt-2021.4.2-vc16-avx2-debug.7z
f8de912a47665b4d5e46332eb97fc7c88e35b5f1b84c604f481cea7adcc976cd opencv-4.5.5-openvino-dldt-2021.4.2-vc16-avx2.zip
cac31973cd1c59bfe9dc926acbde815553d23662ea355e0414b5e50d8f8aa5a8 opencv-4.5.5-vc14_vc15.exe
OpenCV 4.5.4
OpenCV 4.5.4 has been released.
🛠️ Change log is here.
sha256 sums for packages:
9efd9205cb0a5ce124557c9769a399c1af775400d8ef544ceda97807b0fb2baf opencv-4.5.4-android-sdk.zip
6373d1dbd9587fdb600cc367986c14bd6e500d5385ffad83a914d411d659e1e7 opencv-4.5.4-docs.zip
05d9af1ac9ec4e15a7b23c4c91576a9df51498b644f3032abc6093209643392e opencv-4.5.4-ios-framework.zip
5c8135afc3342bb7111e0c0ba4436885fe534e1a870fc91aae33d9a9c9e82fd8 opencv-4.5.4-openvino-dldt-2021.4.1-vc16-avx2.7z
ad2c4e6e34f3d2302fd525052bec070c91aaf79265ea4b0416a46326be36543c opencv-4.5.4-openvino-dldt-2021.4.1-vc16-avx2-debug.7z
0b88bbdced7bfb7e08cf9f34c41798d47988844ab8d3ba939c95ffcdff25a877 opencv-4.5.4-openvino-dldt-2021.4.1-vc16-avx2.zip
d49f6a8ef304de4f5617baf8d9ece51b53a76b3cf5ce26377e4ed7632f0ac467 opencv-4.5.4-vc14_vc15.exe
OpenCV 3.4.16
OpenCV 3.4.16 has been released.
sha256 sums for packages:
1a7469cd54b8f806af4fc96f44eb6aca28b9f8ebdcfc808e29a51a9dad5aa924 opencv-3.4.16-android-sdk.zip
bd7c5079f3caefc051d97011b283abd618cc7ead70c0a8efb9b5458a5b66078b opencv-3.4.16-docs.zip
ed9493c1ad1b9563753425fe8b7011d6a2b0ac3e3449976991a92013f7791d63 opencv-3.4.16-ios-framework.zip
ea807fda2ee6ddd5be432d1bbe9ca7817d181f87de14c13e981ad22e20e64748 opencv-3.4.16-vc14_vc15.exe
OpenCV 4.5.3
OpenCV 4.5.3 has been released.
🛠️ Change log is here.
sha256 sums for packages:
7f9b557a60bd30abc530da014441146b3b839a284709bb075ffd5f02e8942d27 opencv-4.5.3-android-sdk.zip
0c0a660c001d8f8fc0fb5008e05f3f68a1588b877f464267ba385e5ea05bff0b opencv-4.5.3-docs.zip
b85c23953e66f202a5e4b83484f90556ad4ea9df6fcb7934044d5d4decf2898f opencv-4.5.3-ios-framework.zip
dc29d4077b5229362da0eeb9f1dbc34b7aa81972e0189ea8bbdbcff471dd8e06 opencv-4.5.3-openvino-dldt-2021.4-vc16-avx2.7z
4ac25075b47bef4043d64ccecb484329e63617bc3a22107a477f3185b635af08 opencv-4.5.3-openvino-dldt-2021.4-vc16-avx2-debug.7z
000e39b0155a8ab790646e1adce1c604d922ebdca3ac44e8bab2a8afae46ad95 opencv-4.5.3-openvino-dldt-2021.4-vc16-avx2.zip
88eb53fcb81c40f093b18c3eaa818e33d1463d96b47c9713468a68c2c3fccaf0 opencv-4.5.3-vc14_vc15.exe
OpenCV 3.4.15
OpenCV 3.4.15 has been released.
sha256 sums for packages:
517940405619dec8d89d93f42bd5e229afeceada9214d0f62a22560998e3b3aa opencv-3.4.15-android-sdk.zip
cc81527682087615e9cfb8b25bc5255ba4087b52fb05c2a97df811d5e6cbdb01 opencv-3.4.15-docs.zip
5967b50963e4a0ff362b80edb40f29a4da20211fd82fd0e267de0bd94813b0bf opencv-3.4.15-ios-framework.zip
7a975278527e1b690230a241078204e153c33077e152102df300721bb8f9a71c opencv-3.4.15-vc14_vc15.exe
OpenCV 4.5.2
OpenCV 4.5.2 has been released.
🛠️ Change log is here.
sha256 sums for packages:
0199546917dbe858c5c56c9669f303c3c1d633e9149ba0ad210de6749a3f9e0f opencv-4.5.2-android-sdk.zip
b6d1496be42f1e8e95ec848b0ef163cfd63b4adbc02b60526ececde77bcd0e8e opencv-4.5.2-dldt-2021.3-vc16-avx2.7z
ed48fc65e794822b981cf08e64b5801f1c75abe9aab984fee4403962ebf4a071 opencv-4.5.2-dldt-2021.3-vc16-avx2-debug.7z
c3bc298048b58b8269e52324fff555cea68672087882316362213eae4858fee2 opencv-4.5.2-dldt-2021.3-vc16-avx2.zip
32efc654473e92df2cbfaf305014f611502b62373e04117dddeb3cd3ede97f36 opencv-4.5.2-docs.zip
10387024f4c5e353c01a455a6b1bdf33d81b9d7da7654b83c256834eeba9eab5 opencv-4.5.2-ios-framework.zip
106b588a82b3045a44305ba426c281887416745d4ce8f3983156d9f82e89ff75 opencv-4.5.2-vc14_vc15.exe
In this blog post, we will be installing OpenCV on Windows for C++ and Python. The C++ installation is done with the help of custom setup exe files. Whereas Python installation is done with Anaconda.
Installing OpenCV from source takes up a lot of time. Depending on your hardware, and the installation configuration, it can take anywhere from 5 minutes up to 2 hours.
Moreover, the installation is not a cakewalk. Hence, we have come up with a solution for Windows users – OpenCV Windows installers. These installers will only work for installing OpenCV for C++. If you want to install OpenCV for Python, you’ll find the information later in the blog.
If you want to install OpenCV 4 on Windows from source, then check out this blog post.
Table of Contents
Install OpenCV on Windows for CPP
Step 1: Prerequisites
You need Visual Studio pre-installed on your system. You can download the latest version of Visual Studio from here. Otherwise, you can find older versions from here.
Step 2: Download the Installer
Once you have set up Visual Studio on your system, download the installer according to the Visual Studio version you have installed.
Master Generative AI for CV
Get expert guidance, insider tips & tricks. Create stunning images, learn to fine tune diffusion models, advanced Image editing techniques like In-Painting, Instruct Pix2Pix and many more
Step 3: Install OpenCV on Windows
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.
The installer starts with a welcome screen. Click on Next to read the License.
If you accept the license, 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.
After OpenCV is installed, you can exit the installer.
Step 4: Execute a sample code
Once the OpenCV installation is completed, you can start coding right away. We have provided with a sample code to test the installation. Below is the code snippet.
You can download the code using this link.
#include <opencv2/opencv.hpp>
using namespace cv;
int main(void) {
// Read image in GrayScale mode
Mat image = imread("boy.jpg", 0);
// Save grayscale image
imwrite("boyGray.jpg", image);
// To display the image
imshow("Grayscale Image", image);
waitKey(0);
return 0;
}
Download Code
To easily follow along this tutorial, please download code by clicking on the button below. It’s FREE!
If you plan on executing C++ code using Cmake, then download and install from here (windows win64-x64 Installer), and follow instructions below. The third line specifies the Visual Studio version on your system.
mkdir build
cd build
cmake -G "Visual Studio 16 2019" ..
cmake --build . --config Release
cd ..
.\build\Release\sampleCode.exe
The above code reads an input image as grayscale, writes it to the disk, and displays it. Following are input and output to the code.
How are the installers different from Official OpenCV Installers for Windows
These are general-purpose installers, which can install and uninstall OpenCV in under 15 seconds. It’s a quick and clean approach to install OpenCV for your Windows system. You can test out the latest OpenCV version and see if it’s for you. Otherwise, you can install OpenCV without configuring and waiting for hours on end for it to install.
Although the installers are useful for new users, or users who want one-click install, or simply for the ones who struggle with the installation, but these are not the official installers. You can find the official OpenCV binaries from here. There are differences between the installers which we provide and the OpenCV official binaries
- Contrib modules: The official binaries do not contain
opencv_contrib
modules. The installer which we provide does. - Additional setup: The official binaries require additional setup, i.e., editing the environment variables, and using the correct folder address. Our installers will not require additional setup.
- Size: Official binaries are larger in size. They take about 1.21GB. The installers which we provide take around 367MB.
- List of libraries: If you code in Visual Studio, we have provided you with the list of libraries, in Debug and Release mode, as a separate text file. It is available in the root directory of the installation.
- No availability for VS16: The official binaries are not available for VS16, only for VS14 and VS15. Our installers are created for VS14, VS15, and VS16.
Install OpenCV on Windows for Python
Step 1: Install Anaconda for Python 3
While installing Anaconda make sure that you check both options:
- Add Anaconda to my
PATH
environment variable - Register Anaconda as my default Python
Step 2: Create a Virtual Environment
We will use Virtual Environment to install Python libraries. It is generally a good practice in order to separate your project environment and global environment.
Open the command prompt
or Power shell
and execute the following command.
conda create --name virtualenv python=3.8
Step 3: Install OpenCV on Windows
Activate the environment we created just now (virtualenv
) and install all the required libraries using the commands below.
conda activate virtualenv
pip install opencv-contrib-python
And that’s it. OpenCV has been installed on your system. To close the virtual environment, use conda deactivate
.
Step 4: Test Installation
Next, we will check whether the installation was successful. From the command prompt execute the following commands.
# activate environment
conda activate virtualenv
# start python prompt
python
# import cv2 and print version
import cv2
print(cv2.__version__)
# If OpenCV is installed correctly, the above command should output OpenCV version.
# Exit and deactivate environment
exit()
conda deactivate
Summary
In this blog post, we installed OpenCV on Windows with the quickest and easiest method. For C++, we used a simple .exe installer and installed in under 30 seconds. For Python, we used Anaconda as the package manager and installed OpenCV in a virtual environment. We also executed sample programs for both, C++ and Python, to test the installation. This concludes the OpenCV installation.
Subscribe & Download Code
If you liked this article and would like to download code (C++ and Python) and example images used in this post, please click here. Alternately, sign up to receive a free Computer Vision Resource Guide. In our newsletter, we share OpenCV tutorials and examples written in C++/Python, and Computer Vision and Machine Learning algorithms and news.
Features
- computer vision
- deep learning
- opencv
Project Samples
License
BSD License
Track deductions, identify root causes, collaborate with partners, and hold everyone more accountable.
User Ratings
4.7
out of 5 stars
★★★★★
★★★★
★★★
★★
★
ease
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
4 / 5
features
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
4 / 5
design
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
4 / 5
support
1 of 5
2 of 5
3 of 5
4 of 5
5 of 5
4 / 5
Additional Project Details
Operating Systems
Linux, BSD, Android, Mac, Windows
Languages
English
Intended Audience
Science/Research, Developers
Programming Language
Python, C++, Java
Related Categories
Python Robotics Software,
Python HMI Software,
Python Realtime Processing Software,
Python Computer Vision Libraries ,
Python Deep Learning Frameworks ,
C++ Robotics Software,
C++ HMI Software,
C++ Realtime Processing Software,
C++ Computer Vision Libraries ,
C++ Deep Learning Frameworks ,
Java Robotics Software,
Java HMI Software,
Java Realtime Processing Software,
Java Computer Vision Libraries ,
Java Deep Learning Frameworks
You can get the latest setup of OpenCV for Windows. Basically, OpenCV is a great library for computer vision and machine learning. But it can be difficult to get it working on Microsoft Windows systems. This article will show you how to assemble and install OpenCV on your Windows system. This will include both CPU and GPU support. In the end, you will have both debug and release binaries ready to use.
Features
OpenCV is a vast library for computer vision and image processing. It is used in a wide range of applications from face recognition to recognizing objects and handwriting. It is easy to use and has a lot of courses and tutorials to help you get started. To begin using it you need to install Python and pip. You also need to have a GPU-enabled CPU with MMX and SSE support. Several packages are available for Windows. They include both the main and control modules as well as CUDA support. These are ideal for more restrictive environments and are smaller than the official release.
Before installing these packages it is important to ensure that your pip version is up to date (19.3 is the minimum supported version). You can check this by running pip -V. You should also remove any manually installed (not through pip) version of opencv to avoid conflicts. Once you have the correct version of OpenCV installed you can start creating your own projects. To do this you need to create a new project in Visual Studio and select the C++ Console App template. Then go to Configuration Properties/VC++ Directories and add the path of your include directory to the list.
Algorithms
OpenCV supports a large number of state-of-the-art computer vision algorithms and techniques. These include image processing, feature detection and description (such as corner detectors or blob detection), tracking of objects in video streams, 3D reconstruction of scenes using cameras, and various methods for removing red eyes from images and videos.
In addition, you can use the cv::viz module to visualize scene objects and camera positions in a virtual world. This is based on VTK, so you need to install it before using this module.
Other useful features include a high GUI framework that is built on Qt (which requires installation). Intel Threading Building Blocks can be used for parallel code snippets and the CUDA toolkit allows you to take advantage of the GPU to improve performance for certain algorithms (such as optical flow or HOG descriptors). The cv::highgui module provides a more advanced graphical user interface. This is a good choice for users who need a more polished, feature-rich UI than the default Python OpenCV bindings.
Compilation
OpenCV For Windows comes with a pre-compiled library for both 32 and 64-bit Windows architectures using Microsoft Visual C++ (MSVC) compiler. MSVC can be obtained as part of the full Visual Studio installs or, for headless systems, by installing it separately. During the configuration of OpenCV, you can choose to include PTX for multiple GPU architectures to support maximum device coverage or for better performance. PTX is included by default when compiling for x64 platforms but not for x86 — you need to enable it explicitly.
You can also build Python bindings and test projects for each module of the library to ensure that they work as expected on your system. You can also enable the building of a shared binary for all modules (depending on BUILD_SHARED_LIBS) or static libraries (BUILD_STD_LIBS). This will make it easier to run OpenCV from within Python. The build process takes a while depending on your system. When it is complete you can see the results in the Solution Explorer.
Installation
OpenCV comes with many example applications from which you can learn about the library’s capabilities. It can also be used as a starting point for your own projects. In addition, it supports various third-party software libraries during the compilation process. This includes Intel Threading Building Blocks which enables the library to utilize multicore CPUs for faster processing of image data.
To compile OpenCV, you will need a working Python installation and a compatible version of pip. It is recommended to install both the NumPy and SciPy stacks together with Python. If you are using a distribution with older versions of these packages, it is necessary to update them to the latest version.
Once you have everything set up, you can start the build process. The first step is to create a build directory and select the location of the binary files. Next, you will need to configure the source code and CMake. If you want to use CUDA support, be sure to include -DCUDA_ARCH_BIN=6.1.