A free and open-source software library for computer vision and machine learning is called OpenCV. It provides a wide range of functions and tools for image and video processing, feature detection, object recognition, and more. OpenCV is widely used in various fields such as robotics, augmented reality, surveillance, and medical imaging.
In Ubuntu 20.04, OpenCV refers to the specific version of the library that is available for installation and use on that operating system. Ubuntu 20.04 is a popular Linux distribution, and it provides official packages for installing OpenCV through the package manager.
To install OpenCV in Ubuntu 20.04, ensure that you have the following prerequisites installed:
*CMake: A cross-platform build system.
To install CMake in Python, you can use the following command in the terminal:
$ pip install cmake
*Python: A programming language often used with OpenCV.
*Numpy: A Python library for numerical Computation.
To install CMake in Python, you can use the following command in the terminal:
$ pip install numpy
*OpenCV has several dependencies that need to be installed before building it. Run the following command to install the necessary dependencies:
$ sudo apt install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
*Certain additional libraries are required for specific functionalities in OpenCV. Run the following command to install them:
$ sudo apt install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev libeigen3-dev libv4l-dev
To install OpenCV in Ubuntu 20.04, you can use the following command in the terminal:
$ sudo apt update$ sudo apt install libopencv-dev python3-opencv
These commands will install the development files and Python bindings for OpenCV. Once installed, you can start using OpenCV in your Python or C++ programs to perform various computer vision tasks.
To check the version of OpenCV installed on your Ubuntu 20.04 system:
*you can use the following command in the terminal:
$ pkg-config --modversion opencv4
If you have an older version of OpenCv installed (eg:openCv 3.x), you can try using “opencv” instead of “opencv4”.
Or,
$ python3 -c "import cv2; print(cv2.__version__)"
Alternatively, you can check the version of OpenCV installed on your system by running a Python script:
1. Open a text editor or integrated Development Environment(IDE) and create a new Python script.
2. Add the following lines of code to the script
import cv2print(cv2.__version__)
OpenCV is a powerful library that enables developers to perform a wide range of computer vision and image processing tasks. By following the installation steps mentioned above, you can easily set up OpenCV on your system. Its extensive functionalities, including image and video I/O, image processing, feature detection, object detection and tracking, machine learning integration, camera calibration, and user interface, provide you with the tools.