The Wayback Machine - https://web.archive.org/web/20240712080656/https://www.geeksforgeeks.org/how-to-install-opencv-for-python-in-linux/
Open In App

How to Install OpenCV for Python in Linux?

Last Updated : 18 Jan, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite: Python Language Introduction   OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human. When it integrated with various libraries, such as Numpy, python is capable of processing the OpenCV array structure for analysis. To Identify image patterns and its various features we use vector space and perform mathematical operations on these features. To install OpenCV, one must have Python and PIP, preinstalled on their system. To check if your system already contains Python, go through the following instructions: Open the terminal using Ctrl+Alt+T Now run the following command: For Python2

python --version

For Python3.x

python3.x --version

If Python is already installed, it will generate a message with the Python version available. Check-python-version-for-linux If Python is not present, go through How to install Python on Linux? and follow the instructions provided.   PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “on-line repository” termed as Python Package Index (PyPI). To check if PIP is already installed on your system, just go to the terminal and execute the following command:

pip3 --version

pip-Version-check-linux If PIP is not present, go through How to install PIP on Linux? and follow the instructions provided.

Downloading and Installing OpenCV:

OpenCV can be directly downloaded and installed with the use of pip (package manager). To install OpenCV, just go to the terminal and type the following command:

pip3 install opencv-python

Beginning with the installation:

  • Type the command in the Terminal and proceed: OpenCV-Installation-Linux-01
  • Collecting Information and downloading data: OpenCV-Installation-Linux-02
  • Installing Packages: OpenCV-Installation-Linux-03
  • Finished Installation: OpenCV-Installation-Linux-04

To check if OpenCV is correctly installed, just run the following commands to perform a version check:

python3
>>>import cv2
>>>print(cv2.__version__)

OpenCV-Verification-Linux


Previous Article
Next Article

Similar Reads

How to Install opencv in C++ on Linux?
OpenCV stands for open-source Computer Vision Library. It is a library that provides infrastructure for computer vision and machine learning applications. It has more than 2500 Computer vision and machine learning algorithms. They can be used to track objects, recognize faces and objects, stitch images, etc. It can be used with c, c++ python, and j
3 min read
Transition from OpenCV 2 to OpenCV 3.x
OpenCV is one of the most popular and most used Computer vision libraries. It contains tools to carry out image and video processing. When OpenCV 3..4.1 is an improved version of OpenCV 2.4 as it introduced new algorithms and features. Although some of the existing modules were rewritten and moved to sub-modules. In this articles, I will focus on t
2 min read
Top Books for Learning OpenCV: Computer Vision with OpenCV Library
OpenCV or Open Source Computer Vision Library, is an open-source computer vision and machine learning software library. It's extensively used for real-time computer vision tasks such as object detection, face recognition, image processing, etc. Whether you're a beginner or an experienced developer looking to deepen your understanding of OpenCV, her
5 min read
Automatic Document Scanner using OpenCV (OpenCV Document Scanner)
An automatic document scanner using OpenCV is a computer vision application that automatically detects and extracts documents from images. This type of scanner can be useful in various scenarios, such as digitizing paper documents, processing scanned documents, or automating document recognition tasks. In this article, we will see how we can build
6 min read
How to Install OpenCV for Python on Windows?
Prerequisite: Python Language Introduction OpenCV is the huge open-source library for computer vision, machine learning, and image processing and now it plays a major role in real-time operation which is very important in today’s systems. By using it, one can process images and videos to identify objects, faces, or even the handwriting of a human.
2 min read
How to install OpenCV Contrib Python
OpenCV (Open Source Computer Vision Library) is a powerful open-source computer vision and machine learning software library. It provides various tools and algorithms for image and video processing, object detection, feature extraction, and more. OpenCV Contrib is an extension module that includes additional functionalities and algorithms contribut
2 min read
How to Install OpenCV Python Headless?
OpenCV (Open Source Computer Vision Library) is a powerful open-source computer vision and machine learning software library. It enables developers to access a wide range of algorithms for various computer vision tasks. In this article, we will see how to install OpenCV Python Headless. What is OpenCV Python Headless?Installing OpenCV in Python hea
2 min read
How to install OpenCV for Visual Studio Code and Python?
OpenCV is a powerful computer vision library widely used for image and video processing tasks. Integrating OpenCV with Visual Studio Code (VS Code) allows developers to leverage their capabilities within a familiar development environment. In this article, we will see how we can install OpenCV for Visual Studio code and Python. Steps to Install Ope
1 min read
How to Install Opencv 4 on MacOS?
In this article, we will learn how to install Opencv 4 in Python on MacOS. OpenCV (Open Source Computer Vision Library) is a library of programming functions mainly aimed at real-time computer vision. Installation:Method 1: Using pip to install Opencv 4 Package Follow the below steps to install the Opencv 4 package on macOS using pip: Step 1: Insta
2 min read
How to Install OpenCV for C++ on MacOS?
OpenCV stands for Open Source Computer and Vision Library. It is a huge open-source library with more than 2500 algorithms that are optimized to perform various operations like computer vision, image processing, and machine learning in real-time. It performs all these operations in real-time which gives it an edge over all other similar libraries.
4 min read
three90RightbarBannerImg