OpenCV is an open-source computer vision library that can be used for image and video processing, it offers many useful tools such as accessing webcam footage, object recognition within images and more.
To start using OpenCV we must first acquire it and its dependencies, the numpy mathematical library is required and must be installed, the matplotlib library is also used often in conjunction with OpenCV and should also be installed, but this is optional.
Installation using pip on windows machines
OpenCV can be installed along with its dependencies using pip installer from the windows command line.
Installing the numpy library
C:\Users\user> python -m pip install numpy
Installing the matplotlib library (optional)
C:\Users\user> python -m pip install matplotlib
Installing the OpenCV library
The name of the OpenCV library for the pip installer is "opencv-python"
C:\Users\user> python -m pip install opencv-python
Once you have successfully installed OpenCV using the pip installer, you can import it into your Python program as "cv2":
import cv2