Skip to content

Tutorial: Basic OpenCV

Minh-Khang Vu edited this page Aug 22, 2019 · 5 revisions

This tutorial helps beginners understand how to use OpenCV.

OpenCV is a computer vision library, and is the industry standard for quick prototyping, making it very useful for college research use. OpenCV is basically a wrapper for a lot of really useful vision processing functions, thus removing a lot of the grunt work and allowing you to do more interesting things with your time.

The main thing is just that you should understand what the function you're using is doing, which is where google comes in.

Installation

Install package python-opencv with the following command in terminal (as root user).

$ sudo apt-get install python-opencv

To test if OpenCV is installed, type python in the terminal to use Python 2.7. Then type

$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2 as cv

If the results are printed out without any errors, you have installed OpenCV-Python successfully.

Note: we want to install OpenCV for Python 2.7.

Starter Tutorials

For starters though, beginners can look this tutorial to begin: Sophie's OpenCV starters tutorial

It's a color tracking script, and will walk you through how to implement it. From there, more complex functions and such are found/used through Googling and asking upperclassmen. OpenCV is very powerful, so never count it short! If there's something you want to do, OpenCV probably has a group of functions you can use. It's all just about finding it and (most importantly) understanding how it works.

As always, if you need help, just ask!

OpenCV-Python Tutorials

The recommended tutorials below are the most useful! You should grasp some basic understanding of Geometric Transformations of Images, Image Thresholding, Smoothing Images and Camera Calibration.