×

Introduction to Computer Vision

In this tutorial, we will be learning in-depth concepts starting from beginner level to advanced level in Computer Vision. Computer Vision is a module in python that helps a computer understand the input file(videos, images, etc.,) based on algorithms and determine/classify the characteristics of the input file.

OpenCV is a Python-free and open-source library used in the field of Artificial Intelligence, machine learning, Image processing, and GPU acceleration for real-time operation. The library has more than 2500 optimized algorithms that serve the purpose of Tracking and classifying objects in an image, Detect and Identify faces, Process Video & Images, extract 3D models, provide high-resolution images, etc.,

OpenCV was built to provide a common infrastructure for computer vision applications and accelerate the use of machine perception in commercial products. OpenCV is written in C/C++ and provides interfaces in Java, Python, C/C++. It supports operating systems such as Linux, Windows, Mac, IOS, and Android. Since it was written in C/C++ it provides the advantage of multi-core processing.

Applications

  • Face detection
  • Object identification
  • Classification of Human actions
  • Tracking moving objects
  • Extract 3D model of objects
  • Medical Analysis
  • Planetary study
  • Image stitching
  • Image processing

How OpenCV reads Images

  • Import libraries and images
  • Apply algorithms and perform image manipulation
  • Output report

Installing OpenCV

Installing Python

Python does not come as pre-packaged with the operating system. So the users might have to download an appropriate version and install it. Since the initial release of Python in 1991, it has been constantly been updating its versions and fixing the bugs.

For installation purposes, you can choose python – 3.6 to python – 3.8 in order to get the latest features.

Download python

To download the python you can navigate to https://www.python.org/downloads/   and choose the operating system, version, and 32-bit or 64-bit installer based on the configuration you are having.

Python Installation

After you run the installer you can select ADD python to path option and click Customize installation.

While customization you can unselect the documentation, and click next to proceed 

After proceeding to the next window select “Install for all users”, and click install.

Once done with the installation you can check whether Python is installed properly or not by checking the python version using the command python --version

Installing OpenCV-python using pip

Once done with python installation we can download and install OpenCV using the pip command

pip is a package management system in python, it connects to an online repository in public packages known as Python Package index that allows users to install other libraries that are not a part of the standard python library.

The command pip install opencv-python installs opencv library.

This opencv installation also installs the NumPy package.

Now install matplotlib using command pip install matplotlib.

This completes the installation of OpenCV and the libraries that are required for reading and processing images.

Install OpenCV using Anaconda

Anaconda is a distribution of Python and R programming languages that aims to simplify package management, deployment and is focused on data-driven projects. Anaconda provides scientific computing for data science, machine learning, predictive analysis, and long-scale data processing.

You can download the anaconda over https://www.anaconda.com/products/individual, which serves the purpose of individuals and is completely free to download and use.

After you run the installer you can NEXT option and click,  I Agree.

You need to choose the directory and folder for anaconda installation with a disk space of 2.9GB approximately.

Choose whether or not to add Anaconda to your path, it’s not recommended since it may interfere with the other software of your system so instead open the anaconda prompt from the start menu.

After a successful installation, you will see the “Thanks for Installing Anaconda” dialog box.

Now you can open the Anaconda prompt from your windows start option and type the following command for installing open-cv in anaconda.

conda install -c conda-forge opencv

After that proceed to click “yes” to update all the packages.

Once the installation is successful type import cv2 in your code to start using OpenCV and perform operations.