OpenCV

Prakash Dale · August 7, 2020

What is computer vision in Python?

Computer Vision is a field of multiple desciplines that care about how computers can gain a high-level understanding from digital images/videos. This is an attempt to automate tasks that the human visual system is able to perform. This is a process of aquiring, processing, analyzing and understanding digital images, extracting high dimensional data from the real world (to provide numerical/symbolic) information.

Typical task involved in Computer Vision are

  • Recognition
  • Motion Analysis
  • Scene Reconstruction
  • Image Restoration

Fields related to Python Computer Vision are:

  • Artificial Intelligence
  • Solid-state Physics
  • Neurobiology
  • Signal Processing
  • Statistics, Optimization, Geometry

Some of the applications of Python Computer Vision are:

  • Automatic inspection in manufacturing applications
  • Assisting humans in identification tasks (e.g. species identification system)
  • Controlling processes (e.g. an industrial robot)
  • Detecting events (e.g. visual surveillance)
  • Interation (e.g. input to the device for human-computer interaction)
  • Modeling objects/environments (e.g. medical image analysis)
  • Navigation (e.g. autonomous vehicles)
  • Organizing information (e.g. indexing databases of images and image sequencing)

Setup

  • Create conda enviroment with Python 3.7. I have named mine as ‘opencv’
  • Install opencv-python using command pip install opencv-python
  • Go to python shell and type import cv2 and press enter. It should not give any error.
  • Clone the OpenCV github repository for sample code and data. Data folder contains many sample images and videos which can be used for learning purpose.

Check OpenCV Version

Read Image

Read Video

Draw geometric shapes on the image

Set camera properties

Show date-time overlay

Handle mouse events

Split, merge images

Bitwise operations on images

Bind trackbar to OpenCV window

Object detection

Simple image thresholding

Matplotlib

Smoothing/blurring images

Image gradient edge detection

Canny edge detection

Image pyramids

Blend images

Find and draw contours

Motion detection

Detect geometric shapes

Screen recording

Twitter, Facebook