Home>Article>Backend Development> How to install opencv library in Python

How to install opencv library in Python

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-06-13 16:09:26 9153browse

OpenCV is a cross-platform computer vision library released under the BSD license (open source) and can run on Linux, Windows, Android and Mac OS operating systems. It is lightweight and efficient - it consists of a series of C functions and a small number of C classes. It also provides interfaces in Python, Ruby, MATLAB and other languages, and implements many common algorithms in image processing and computer vision.

OpenCV is written in C language, and its main interface is also C language, but it still retains a large number of C language interfaces. The library also has extensive interfaces to Python, Java and MATLAB/OCTAVE (version 2.5). API interface functions for these languages can be obtained through online documentation. Now it also provides support for C#, Ch, Ruby, and GO.

All new developments and algorithms use C interface. A GPU interface using CUDA was also implemented in September 2010.

This article teaches you how to install the OpenCV library in Python under Windows system.

Related recommendations: "Python Video Tutorial"

How to install opencv library in Python

Because of the powerful pip, you only need two steps to install OpenCV Library

The steps are as follows:

Step one: Win R to open the run, enter cmd to enter the command line window, and see the following interface:

How to install opencv library in Python

Step 2: Directly enter pip install opencv-python, as shown below:

How to install opencv library in Python

Waiting for installation ……

How to install opencv library in Python

#*Emphasis: On the surface of the red line in the picture, pip downloads the OpenCV library from this address.

Download completed.

How to install opencv library in Python

As you can see from the red line in the picture, the Opencv library has been successfully installed, and the size of this library is 23.1MB.

At this point, you can import cv2 at will.

How to install opencv library in Python

#The above is a test, that is, when you enter the Python IDE and type import cv2, no error is reported, indicating that the OpenCV library is successfully installed.

The above is the detailed content of How to install opencv library in Python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn