Video Tutorials (OpenCV 2.4)

A tutorial series contributed by Surya Penmetsa. You can find the codes used in the videos here.

thumbnail
Tutorial 1: Setup Video

This is the first tutorial, where I explain how to install the softwares and get things working to use the OpenCV functions.

thumbnail
Tutorial 2: Face Detection Video

This is the second tutorial, where I explain how to use OpenCV functions to detect faces on MATLAB.

thumbnail
Tutorial 3: Webcam Input Video

This is the third tutorial, where I explain how to use OpenCV functions to record video input on MATLAB.

thumbnail
Tutorial 4: Feature Extraction and Matching Video

This is the fourth tutorial, where I explain how to use OpenCV functions to extract features to match objects on MATLAB.

core: Core Functionality

thumbnail
Rotated Rectangle

The sample demonstrates how to use cv.RotatedRect.

thumbnail
Reading/Writing XML and YAML files

Demonstration of reading/writing from/to XML and YAML file storages.

thumbnail
Serialization Functionality

Demonstrate the usage of OpenCV serialization functionality.

thumbnail
Image Blending GUI

In this demo, we add two images using cv.addWeighted which defines a linear blend operator: $g(x) = (1 - \alpha)f_{0}(x) + \alpha f_{1}(x)$.

thumbnail
Bitwise Operations on Images

In this demo, we show how to perform arithmetic operations on images like addition, subtraction, bitwise operations, etc.

thumbnail
Brightness and contrast adjustments GUI

In this demo we show how to perform the operation: $g(i,j) = \alpha \cdot f(i,j) + \beta$.

thumbnail
Image padding GUI

In this demo, we show how to use the OpenCV function cv.copyMakeBorder to set the borders (extra image padding).

thumbnail
inRange Thresholding Operations GUI

In this demo we show how to perform basic thresholding operations using OpenCV function cv.inRange, and detect an object based on the range of pixel values it has.

thumbnail
Discrete Fourier Transform

This program demonstrated the use of the discrete Fourier transform (DFT). The DFT of an image is taken and it's power spectrum is displayed.

thumbnail
Kaleidoscope

Demonstrates Kaleidoscopic reflections.

imgproc: Image Processing

thumbnail
Demonstration of drawing functions

This program demonstrates OpenCV drawing and text output functions.

thumbnail
Basic Geometric Drawing

In this demo, we show how to use basic drawing functions (line, ellipse, rectangle, circle, etc.).

thumbnail
Demonstration of text drawing functions

Demonstration of text drawing functions.

thumbnail
Colormaps GUI

Sample shows how to apply false color on a grayscale image.

thumbnail
Delaunay triangulation GUI

This program demonstrates iterative construction of Delaunay triangulation and Voronoi tessellation.

thumbnail
Convex Hull demo GUI

We learn how to get hull contours and draw them.

thumbnail
Retrieve and label connected components from a binary image.

The example below shows how to retrieve connected components from a binary image and label them.

thumbnail
Contours Demo

This program illustrates the use of cv.findContours and cv.drawContours.

thumbnail
Watershed Demo GUI

This program demonstrates the famous watershed segmentation algorithm in OpenCV.

thumbnail
Contours in OpenCV

In the sample, we will understand what contours are, and learn about the hierarchy of contours, and how to find and draw contours.

thumbnail
Finding contours in an image GUI

We learn how to find contours of objects in our image.

thumbnail
Flood-filling in an image GUI

An example using the Flood-Fill technique.

thumbnail
Flood-Fill demo

Demonstrates how to use cv.floodFill.

thumbnail
Image Thresholding

In this demo, we will learn about simple thresholding, adaptive thresholding, and Otsu's thresholding.

thumbnail
Threshold demo GUI

Sample code that shows how to use the diverse threshold options offered by OpenCV.

thumbnail
Smoothing Demo

Sample code for simple filters.

thumbnail
Smoothing Images

In this tutorial you will learn how to apply diverse linear filters to smooth images.

thumbnail
Polar Transforms demo GUI

This program illustrates Linear-Polar and Log-Polar image transforms.

thumbnail
Erosion and Dilation GUI

In this sample, you will learn how to apply two very common morphological operators: Erosion and Dilation.

thumbnail
Advanced Morphology Transformations Demo GUI

In this sample you will learn how to use the OpenCV function cv.morphologyEx to apply Advanced Morphological Transformation.

thumbnail
Extracting horizontal and vertical lines using morphology

Example that uses morphology transformations for extracting horizontal and vertical lines.

thumbnail
Hit-or-Miss Morphological Operation

In this tutorial you will learn how to find a given configuration or pattern in a binary image by using the Hit-or-Miss transform.

thumbnail
Creating Bounding boxes and circles for contours

Demo code to find contours in an image, and create bounding boxes and circles.

thumbnail
Creating Bounding rotated boxes and ellipses for contours

Demo code to obtain ellipses and rotated rectangles that contain detected contours.

thumbnail
Fit ellipses GUI

This program is demonstration for ellipse fitting. The program finds contours and approximate them by ellipses.

thumbnail
Robust Line Fitting GUI

Example of using cv.fitLine function for fitting 2D line to points in presence of outliers.

thumbnail
Image Moments GUI

We learn to calculate the moments of an image.

thumbnail
Gabor Filter demo GUI

A GUI to interact with the 5 different Gabor filter parameters, while visualizing the resulting filter.

thumbnail
Fractalius-like image effect using Gabor filters

This sample demonstrates the use of multiple Gabor filter convolutions to get Fractalius-like image effect.

thumbnail
Line Segment Detector demo

An example using the cv.LineSegmentDetector class.

thumbnail
Hough line detector

An example using the Hough line detector.

thumbnail
Hough circle detector

An example using the Hough circle detector.

thumbnail
Generalized Hough transform

This program demonstrates arbitrary object finding with the Generalized Hough transform.

thumbnail
Interactive foreground extraction using GrabCut GUI

Interactive foreground extraction using the GrabCut algorithm.

thumbnail
Image pyramids for image blending

Learn about image pyramids and how to use them for image blending.

thumbnail
Laplacian Pyramid Construction and Merging GUI

The Laplacian Pyramid as a Compact Image Code.

thumbnail
Image Warping GUI

This program shows perspective transformation applied on an image.

thumbnail
Interactive Perspective Transformation GUI

This program demonstrates Perspective Transformation.

thumbnail
Image Alignment using ECC algorithm

This sample demonstrates the use of the ECC image alignment algorithm.

thumbnail
Corner Detection

In this demo we will understand concepts behind Harris Corner Detection. We also learn about another corner detector, the Shi-Tomasi Corner Detector.

thumbnail
Refining Corner Locations GUI

Demo code for detecting corners using Shi-Tomasi method and refining corner locations.

thumbnail
Template Matching

This program demonstrates template match with mask.

thumbnail
Phase Correlation GUI

Demonstrates estimating translational shift between two successive frames using Phase Correlation.

thumbnail
Convex Hull

This sample program demonstrates the use of the cv.convexHull function.

thumbnail
Minimum Area Enclosing

This program demonstrates finding the minimum enclosing box, triangle or circle of a set of points.

thumbnail
Connected Components GUI

This sample demonstrates connected components labeling.

thumbnail
Canny Edge Detection GUI

This sample demonstrates Canny edge detection.

thumbnail
Laplacian Edge Detection GUI

This program demonstrates Laplace point/edge detection using OpenCV function cv.Laplacian.

thumbnail
Create Binary Mask Interactively GUI

Interactively create a polygon mask.

thumbnail
Create Binary Mask Interactively (IPT)

Interactively create a polygon mask.

thumbnail
Interactive Rectangle Selection

Select a rectangle by drawing a box using the mouse, using RectSelector helper class.

thumbnail
Distance Transform GUI

Program to demonstrate the use of the distance transform function between edge images.

thumbnail
Intensity Image Histogram GUI

This program demonstrates the use of cv.calcHist for histogram creation.

thumbnail
Histogram Calculation

In this demo, we show how to divide an image into its correspondent planes and calculate histograms of arrays of images.

thumbnail
Histogram Equalization

In this demo, we show what an image histogram is and why it is useful.

thumbnail
Histogram Comparison

In this demo, we show how to use the function cv.compareHist to get a numerical parameter that express how well two histograms match with each other.

thumbnail
2D Histogram

We explain how to create a 2D color histogram.

thumbnail
Video Histogram GUI

Demo to show live histogram of video, both 1D histograms of RGB channels and 2D histogram of Hue-Saturation.

thumbnail
Back Projection GUI

In this demo, we will learn what is Back Projection and why it is useful.

thumbnail
CAMShift GUI

In this demo, we learn about Meanshift and Camshift algorithms to find and track objects in videos.

thumbnail
Histogram-based face tracker with CAMShift

In this demo, we implement a simple face tracker applied on an input video.

thumbnail
CLAHE (Contrast Limited Adaptive Histogram Equalization) GUI

In this demo, we will learn the concepts of histogram equalization and use it to improve the contrast of our images.

thumbnail
Image Remapping

In this demo, we show how to use the OpenCV function cv.remap to implement simple remapping routines.

thumbnail
Fun with remap

Maps a rectangular image into a circle.

thumbnail
Image Affine Transformation

In this demo, we show how to implement simple affine remapping routines.

thumbnail
Image Pyramids GUI

In this demo, we show how to use the functions cv.pyrUp and cv.pyrDown to downsample or upsample a given image.

thumbnail
Sobel Derivatives

In this demo, we show how to calculate the derivatives of an image using the OpenCV functions cv.Sobel and cv.Scharr.

thumbnail
Laplace Operator

In this demo, we show how to use the OpenCV function cv.Laplacian to implement a discrete analog of the Laplacian operator.

thumbnail
Point Polygon Test

In this sample you will learn how to use the OpenCV function cv.pointPolygonTest.

thumbnail
Points Inside Convex Polygon

We define a pentagon and a set of points. Then, determine which points lie inside, outside, or on the edge of the pentagon.

thumbnail
Image Segmentation with Distance Transform and Watershed Algorithm

Sample code showing how to segment overlapping objects using Laplacian filtering, in addition to Watershed and Distance Transformation.

thumbnail
Wiener Deconvolution for Image Deblurring GUI

Sample shows how DFT can be used to perform Weiner deconvolution of an image with user-defined point spread function (PSF).

thumbnail
Texture flow direction estimation

Sample shows how cv.cornerEigenValsAndVecs function can be used to estimate image texture flow direction.

thumbnail
Coherence-Enhancing Filtering GUI

Coherence-Enhancing Shock Filters.

thumbnail
Multi-Scale Turing Patterns Generator

Generate mathematical artwork.

thumbnail
Hi-Resolution Image Navigation GUI

Sample shows how to implement a simple hi-resolution image navigation.

thumbnail
Squares Detector

It loads several images sequentially and tries to find squares in each image.

imgcodecs: Image File Reading and Writing

thumbnail
Image similarity under lossy compression

Similarity measurements (PSNR and SSIM).

thumbnail
Create PNG image with alpha transparency

Sample shows how to create an RGBA image and store it as a PNG file.

videoio: Media I/O

thumbnail
Video Capture GUI

We learn how to capture live stream from camera and display it, while adjusting basic video color properties.

thumbnail
Creating a video

This demo shows how to write video files.

thumbnail
Synthetic video

Demonstrates using VideoSynth classes as stub for cv.VideoCapture.

video: Video Analysis

thumbnail
Segment objects in Background Subtractor GUI

An example using drawContours to clean up a background segmentation result.

thumbnail
Tracking of rotating point using Kalman filter GUI

Tracking of rotating point.

thumbnail
Dual TV-L1 Optical Flow

Optical Flow Estimation using Dual TV-L1 method.

thumbnail
Farneback Optical Flow GUI

This program demonstrates dense optical flow algorithm by Gunnar Farneback.

thumbnail
Dense Optical Flow GUI

Demo shows how to compute the optical flow for all the points in the frame using cv.calcOpticalFlowFarneback.

thumbnail
Sparse Optical Flow GUI

In this demo, we will understand the concepts of optical flow and its estimation using Lucas-Kanade method.

thumbnail
Lucas-Kanade Sparse Optical Flow GUI

Sparse optical flow to track points.

thumbnail
Lucas-Kanade Optical Flow GUI

A demo of Lukas-Kanade optical flow.

thumbnail
Lucas-Kanade Tracker GUI

Lucas-Kanade sparse optical flow demo. Uses cv.goodFeaturesToTrack for track initialization and back-tracking for match verification between frames.

thumbnail
Lucas-Kanade Homography Tracker GUI

Lucas-Kanade sparse optical flow demo. Uses cv.goodFeaturesToTrack for track initialization and back-tracking for match verification between frames. Finds homography between reference and current views.

calib3d: Camera Calibration and 3D Reconstruction

thumbnail
Collect Calibration Pattern Images

This sample is used to take snapshots of a calibration pattern from live webcam. These images can be later used for camera calibration.

thumbnail
Camera Calibration

This example demonstrates camera calibration in OpenCV.

thumbnail
Pose Estimation

In this sample, we learn to exploit calib3d module to create some 3D effects in images from a calibrated camera.

thumbnail
Stereo Calibration with square chessboard

Demonstration of stereo calibration, rectification, and correspondence.

thumbnail
Stereo Image Matching

Example of stereo image matching to produce a disparity map and point cloud generation.

thumbnail
Epipolar Geometry

In this sample we will learn about the basics of multiview geometry, and we see what is epipole, epipolar lines, epipolar constraint etc.

feature2d: 2D Features Framework

thumbnail
FAST Algorithm for Corner Detection

In this demo, we will understand the basics of FAST algorithm to find corners.

thumbnail
ORB (Oriented FAST and Rotated BRIEF)

In this demo, we will see the basics of ORB.

thumbnail
Feature Matching + Homography to find a known object

In this sample, you will use features2d and calib3d to detect an object in a scene.

thumbnail
Affine invariant feature-based image matching

This sample uses the affine transformation space sampling technique, called ASIFT.

thumbnail
AKAZE local features matching

In this demo, we will learn how to use AKAZE local features to detect and match keypoints on two images. We will find keypoints on a pair of images with given homography matrix, match them and count the number of inliers.

thumbnail
AKAZE and ORB planar tracking

In this demo, we will compare AKAZE and ORB local features by using them to find matches between video frames and track object movements.

thumbnail
Detect, Compute, and Match Descriptors

This program demonstrates how to detect, compute, and match descriptors using various algorithms: ORB, BRISK, and AKAZE.

thumbnail
Blob Detection

This program demonstrates how to use BLOB to detect and filter region.

thumbnail
Maximally Stable Extremal Regions (MSER)

This program demonstrates how to use MSER to detect extremal regions.

thumbnail
Multi-target planar tracking

Example of using features2d framework for multiple planar targets tracking in a video using homography matching.

thumbnail
Feature homography based planar tracking

Example of using features2d framework with homography matching for tracking planar objects in a video.

thumbnail
Planar augmented reality

This sample shows an example of augmented reality overlay over a tracked planar object to show its pose in 3D space.

thumbnail
Correlation-based Tracking using MOSSE Filters

Correlation filter based tracking using MOSSE filters (Minimum Output Sum of Squared Error).

objdetect: Object Detection

thumbnail
Face Detection GUI

Here is an example that illustrates how to detect faces in a live video stream.

thumbnail
Face and Eyes Detection GUI

In this demo, we will learn the basics of face detection using Haar Feature-based Cascade Classifiers, and how the same extends for eye detection, etc.

thumbnail
Facial Features Detection

A program to detect facial feature points using Haarcascade classifiers for face, eyes, nose and mouth.

thumbnail
Smile Detection GUI

This program demonstrates the smile detector.

thumbnail
DBT Face Detection GUI

Detection-Based Tracker Face Detector.

thumbnail
People Detection using HoG GUI

This program demonstrates the use of the HoG descriptor using the pre-trained SVM model for people detection.

dnn: Deep Neural Network module

thumbnail
Deep Neural Network with Caffe models

In this tutorial you will learn how to use DNN module for image classification by using GoogLeNet trained network from Caffe model zoo.

thumbnail
Fully-Convolutional Networks for Semantic Segmentation

Fully Convolutional Models for Semantic Segmentation.

thumbnail
DNN Image Classification

Image Classification task using DNN.

thumbnail
DNN Semantic Segmentation

This sample demonstrates semantic segmentation, where we label each pixel in the image with a category label.

thumbnail
DNN Object Detection

This sample uses Single-Shot Detector to detect objects on image (produces bounding boxes and corresponding labels).

thumbnail
DNN Face Detection

Face detector based on SSD framework (Single Shot MultiBox Detector).

thumbnail
DNN Face Recognition

Face detection and recognition based on SSD and OpenFace embedding.

thumbnail
DNN: Style Transfer

Maps the artistic style of various pieces of artwork onto input image.

ml: Machine Learning

thumbnail
K-Means Clustering

This program demonstrates kmeans clustering. It generates an image with random points, then assigns a random number of cluster centers and uses kmeans to move those cluster centers to their representitive location.

thumbnail
EM Clustering

Demonstrates EM clustering.

thumbnail
Gaussian Mixture Model (GMM)

Demonstrates EM clustering, and also compares againt K-means clustering.

thumbnail
K-Means Color Quantization

We will learn how to use cv.kmeans for data clustering of pixels to perform color quantization.

thumbnail
Comparison of different classifiers on the same dataset

This demonstrates an example of machine learning algorithms in a simple classification problem. It compares different classifiers using the same data samples.

thumbnail
Showcase different classifiers

Example using different classifiers.

thumbnail
Logistic Regression

Logistic Regression to classify hand-written digits.

thumbnail
Support Vector Machines (SVM)

In this sample, you will learn how to use the OpenCV function cv.SVM to build a classifier based on SVMs and to test its performance.

thumbnail
K-Nearest Neighbors (KNN)

In this demo, we will understand the concepts of k-Nearest Neighbour (kNN) algorithm, then demonstrate how to use kNN classifier for 2D point classification.

thumbnail
Principal Component Analysis (PCA)

In this demo, you will learn how to use the OpenCV class cv.PCA to calculate the orientation of an object.

thumbnail
PCA for dimensionality reduction

This program demonstrates how to use OpenCV PCA with a specified amount of variance to retain.

thumbnail
SVMSGD Interactive Classification GUI

Train a classifier with SVMSGD algorithm that can handle linearly separable 2-class dataset.

thumbnail
OCR of hand-written digits using KNN

We will use kNN to build a basic OCR application.

thumbnail
OCR of English letters using KNN

We will use kNN to build a basic OCR application.

thumbnail
OCR of hand-written digits using HoG and SVM

In this tutorial, we will build an SVM classifer to recognize hand-written digits (0 to 9), using Histogram of Oriented Gradients (HOG) as feature vectors.

photo: Computational Photography

thumbnail
High Dynamic Range Imaging

In this tutorial we show how to generate and display HDR image from an exposure sequence.

thumbnail
Inpainting GUI

We will learn how to remove small noises, strokes, etc. in old photographs by a method called inpainting.

thumbnail
Non-Photorealistic Rendering

This tutorial demonstrates how to use OpenCV Non-Photorealistic Rendering Module.

thumbnail
Seamless Cloning

This tutorial demonstrates how to use OpenCV seamless cloning module.

thumbnail
Non-Local Means Image Denoising

In this demo, we will learn about Non-local Means Denoising algorithm to remove noise in an image.

stitching: Images Stitching

thumbnail
Simple rotation model images stitcher

A basic example on image stitching.

thumbnail
Rotation model images stitcher

A detailed example on image stitching.

shape: Shape Distance and Matching

thumbnail
Shape context for shape matching

This program demonstrates a method for shape comparison based on Shape Context.

superres: Super Resolution

thumbnail
Super Resolution algorithms for video sequence

This sample demonstrates Super Resolution algorithms for video sequence.

videostab: Video Stabilization

thumbnail
Video Stabilizer

This sample demonstrates video stabilization algorithms for video sequence.