Javatpoint Logo
Javatpoint Logo

Install OpenCV in Ubuntu

What is OpenCV?

OpenCV (stands for open-source computer vision library) is the programming function's library primarily focused on real-time computer vision. It was originally integrated by Intel and later offered by Willow Garage then Itseez (later inherited by Intel). OpenCV is free and cross-platform for use upon the open-source Apache 2 License. It features acceleration of GPU for real-time implementations beginning with 2011.

What is Computer Vision?

Computer vision can be described as a process from which we can know the concept of the videos and images how they are stored and how we can retrieve and manipulate information from them. Computer vision is a base or mostly applied for Artificial Intelligence. It is playing a big role in robotics, self-driving cars, and photo correcting applications as well.

Computer vision is a discipline that describes how to understand, interrupt, and reconstruct a 3D view using its 2D images, regarding the structure properties available in the view. It deals with replicating and modeling human vision with computer hardware and software.

Computer vision can significantly overlap with the below-mentioned fields:

  • Pattern Recognition: Pattern recognition describes various methods to classify several patterns.
  • Image Processing: Image processing emphasis on image manipulation.
  • Photogrammetry: Photogrammetry is concerned with getting correct measurements from images.

Functionalities of OpenCV

Some important functionalities of OpenCV are mentioned below:

  • CUDA acceleration
  • Clustering and machine learning (flann, ml)
  • Computational photography (video, photo, superres)
  • Stereo computer vision or geometry-based monocular (videostab, stitching, calib3D)
  • Feature/object detection (nonfree, features2d, objdetect)
  • Video/image I/O, display, processing (highgui, core, imgproc)

What is Image processing?

It is a method for performing a few operations on any image, to receive an enhanced image, or to extract a few useful information using it. The basic image processing definition can be, "Image processing is the manipulation and analysis of digitized image for improving its quality".

Digital image

The images may be categorized as a two-dimensional function f(x,y), in which x and y are plane (spatial) coordinates, and the fat amplitude for any co-ordinate pair is known as the grey or intensity level of an image at that particular point.

The images are nothing but the two-dimensional matrix, which is specified by a mathematical function f(x,y) at any particular point, is providing the value of a pixel of the image at that point, the value of that pixel specifies how bright that particular pixel is, and which color it will be.

Basically, image processing is signal processing where the input is known as an image and the outcome is known as characteristics or image according to need related to that image.

Image processing has the below three steps:

  • Manipulating and analysis of the image
  • Importing an image
  • Output where the result could be altered report or image that is based on the image analysis

History of OpenCV

In 1999, OpenCV was officially launched and it was an initiative of Intel Research to advance applications of CPU-intensive, a series part of projects with 3D display walls and real-time ray tracing. The primary contributors to this project contained several optimization experts in the Performance Library Team and Intel Russia. In the starting time of OpenCV, the project goals were specified as:

  1. The knowledge of dissemination vision by offering a basic infrastructure that all developers can create on, so that code will be more readily transferable and readable.
  2. The research of advanced vision by offering not just open but optimized code as well for common vision infrastructure.
  3. Advance vision-based technical applications by enabling performance-optimized and portable code available at no cost along with a license that didn't need code to be free for open itself.

In 2000, the first OpenCV alpha version was published to the public at the IEEE Conference on Computer Vision and Pattern Recognition, and 5 betas were published during 2001-2005. In 2006, the initial 1.0 version was published. The 1.1 version "pre-release" was published in October 2008. In October 2009, the second major OpenCV version was released.

OpenCV 2 contains major modifications to the interface of the C++, focusing on better implementations, new functions, more type-safe patterns, and easier for existing ones in contrast to performance (mainly on multi-core systems). Now, official versions appear every 6 months, and improvement is now implemented by the Russian team which is supported by technical corporations.

For OpenCV, the support was taken over via a non-profit foundation which is known as in August 2012. This Foundation manages a user and developer site.

Intel sealed an agreement for acquiring Itseez which is a leading OpenCV developer in May 2016.

OpenCV disclosed and started a Kickstarter Campaign for OpenCV AI Kit which is a hardware module series and inclusions to OpenCV supporting AI.

Applications of OpenCV

The application areas of OpenCV include:

Install OpenCV in Ubuntu
  • Augmented reality
  • Motion tracking
  • Structure from motion (short for SFM)
  • Stereopsis stereo vision
  • Recognition and segmentation
  • Object detection
  • Motion understanding
  • Mobile robotics
  • Human-computer interaction (short for HCI)
  • Gesture recognition
  • Facial recognition system
  • Egomotion estimation
  • 3D and 2D feature toolkits

For supporting a few of the above-mentioned areas, Open CV has a statical library for machine learning that includes:

  • Deep neural networks (short for DNN)
  • Support vector machine (short for SVM)
  • Random forest
  • Artificial neural networks
  • Naive Bayes classifier
  • k-nearest neighbor algorithm
  • Expectation-maximization algorithm
  • Gradient boosting trees
  • Decision tree learning
  • Boosting

Programming language of OpenCV

OpenCV is specified in the C++ language and its main interface is inside this language, but it still has a less broad though the extensive older interface of C. Every new algorithm and development occurs in the C++ interface. There are several bindings in MATLAB/OCTAVE, Java, and Python. The API for the interfaces could be detected in the online documentation.

Many wrappers in various programming languages have been improved for encouraging adoption from a wider audience. JavaScript bindings for a specific OpenCV function's subset were published as OpenCV.js to be applied for web platforms in the 3.4 version.

OS support in OpenCV

OpenCV executes on many desktop OSes. Some of these are mentioned below:

  • Windows
  • OpenBSD
  • NetBSD
  • FreeBSD
  • macOS
  • Linux

OpenCV also runs on several mobile OSes which are mentioned below:

  • BlackBerry 10
  • Maemo
  • iOS
  • Android

The users can receive official versions from SourceForge or get the latest sources using GitHub. Also, OpenCV applies the concept of CMake.

Hardware acceleration

When the library detects the Integrated Performance Primitives of Intel on the computer, it will apply this proprietary routine for accelerating itself:

  • An OpenCL-based interface of GPU has been in development since 2012 October, documentation for the version could be found at the docs.opencv.orgwebsite.
  • A CUDA-based interface of GPU has been in development since 2010 September.

Installing OpenCV in Ubuntu

As we explained above, OpenCV is a computer vision library that stands for Open-Source Computer Vision Library. In this abbreviation, open defines an open-source library along with bindings for Java, C++, and python and supports distinct types of operating systems such as Linux and Windows.

It can use GPU acceleration and multi-core processing for real-time operating operations. The library of OpenCV can be used for a number of applications including medical image analysis, 3D model extraction, face detection and recognition, surveillance video, motion tracking, and much more.

We will explain how we can install OpenCV in the 20.04 version of Ubuntu in this article.

Installing OpenCV with Ubuntu Repository

In the 20.04 version of Ubuntu, the library of OpenCV is available inside the official Ubuntu repository. First of all, we need to update our apt cache by entering the following command in the terminal window:

Install OpenCV in Ubuntu

Then, we will install OpenCV by executing the following command in the terminal window:

Install OpenCV in Ubuntu

This command will help us to install every necessary package on our system.

After finishing the installation process of OpenCV, we can also verify the installation process by importing the module, i.e., cv2, and print the installed OpenCV version by running the following command in the terminal window:

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA