OpenCV is a highly optimized library that is aimed for building real-time computer vision and machine learning applications, it was built to provide a common infrastructure among computer vision engineers and to accelerate the use of machine perception in the commercial products.
The project nowadays is backed by a large community of developers and users. OpenCV has a lot of built-in image processing functions that can help you to get started with computer vision.
In this tutorial, you will learn how to install OpenCV for Python on Ubuntu 20.04. The only prerequisite is you need to have an Ubuntu machine with root user or sudo privileges.
First, refresh the packages index, so we can then install the latest versions of packages:
$ sudo apt update
Now let’s install OpenCV:
$ sudo apt install python3-opencv -y
-y flag will confirm that we’re agreeing for all required dependencies for OpenCV (including Numpy, and many more packages), this will take few seconds/minutes depending on your hardware.
Finally, let’s verify we have installed it:
$ python3 Python 3.8.2 (default, Jul 16 2020, 14:00:26) [GCC 9.3.0] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cv2 >>> cv2.__version__ '4.2.0' >>> print("We have successfully installed OpenCV!") We have successfully installed OpenCV!
Awesome, as you can see, we have successfully installed the latest version of OpenCV library on Ubuntu.
Happy Installing ♥