Computer Vision Fundamentals - Autumn 2004-05

Intructor: Dr Sohaib A. Khan
sohaib at lums dot edu dot pk

Salman Cheema
salmanc at lums dot edu dot pk

Kashif Javed

  Instructor Office hrs: (Rm 405 Lib)
Tue 1500-1600
Wed 1500-1600
Thu 1500-1600

TAOffice hrs:
Mon 1130-1300 (Computer Labs)
Wed 1130-1300 (Computer Labs)

Tue 1430-1600 (TA Rm, Lib 1st floor)
Thu 1430-1600 (TA Rm, Lib 1st floor)

Course Outline [PDF, 50 KB]

Useful Vision Links:
Computer Vision Homepage
Compendium of Computer Vision
Visionary: A Dictionary of terminology in Vision Research
Keith Price Computer Vision Bibliography
Computer Vision Handbook
VisList: Archive of

Date Lecture Content
Slides are available from \\badar\common\cs436, and are not accessible from outside LUMS.
Material in these slides (including images, data etc.) must not be used for commercial benefit without instructor's written permission.
6 Sep 2004

Lecture 1 [download]:

  • Course introduction and policies
  • Introduction of Computer Vision area
  • The complexity of high-level vision tasks
  • Human perception, and cues that aid in perception
  • Modules of the course



8 Sep 2004

Lecture 2 [download]:

  • Image Representation
    Image coordinates
    Homogeneous coordinates
    Binary, Gray-scale and Color images
    Example operations on images
  • Image Histogram (gray-scale histogram, color histogram)
  • Cameras
    Shutter speed
    Digital cameras
    Video cameras
    Interlacing, progressive scan
    Human eye
  • Portable Bit Map Formats
    PGM, PPM file formats
    Reading/Writing binary pgm/ppm files

Assignment 0 (no credit)
Write functions ReadBinPGM, ReadBinPPM, WriteBinPGM, WriteBinPPM in C/C++

Example PPM/PGM Files: mecca06.pgm, mecca06.ppm

Light experiment files (PPM):
right-lamp, left-lamp, ambient

Irfanview is a good image viewer. You can
get it from

Format specification:
[Thanks to Numan Sheikh for sending me these. See for these and more format specs]

Shapiro Ch 1, 2.1-2.6
UCF Vision lab projects page

10 Sep 2004

Lecture 3 [download]:

  • Transformations
    Example Application: Image Registration
  • Transformations in 2D
    Shear in x- and y-direction
    Inverse transformations
  • Cocatenation of transformations
    Rotation about arbitrary point
    Importance of order



13 Sep 2004

Lecture 4 [download]:

  • Affine Transformation
  • Rigid Body Transformation
  • Recovering the best affine transformation from correspondences
    Least Squared Error solution
    Pseudo Inverse
  • Projective Transformation
  • Other displacement models
    Pseudo Perspective

Reading: Shapiro 11-11.4

Steve Mann's paper on video orbits [web][local] contains a nice introduction to these transformations (see sections I and II of this paper)


15 Sep 2004

Lecture 5 [download]:

  • Displacement models
  • Warping
    Bilinear Interpolation
  • 3D Translation and Scaling
  • 3D Rotation
    Rotations about principal axes
    Small angle approximation
    Rotation about arbitrary axis
    Rodrigues' Formula

Homework 1: Image Warping [handout]
Due: Wed Sept 22, 2004 at 5:00

Test images

Reading: Shah 1.1-1.3, 1.8

17 Sep 2004

Lecture 6 [download]:

  • Rodrigues' Formula
  • Eigenvalues and Eigenvectors of Rotation Matrix



20 Sep 2004

Lecture 7 [download]:

  • Frames of Reference
  • Pinhole Camera
  • Perspective Transform
  • Camera Model

Reading: Shah 1.4-1.5, Gonzales handout

Quiz1 [download]

22 Sep 2004

Lecture 8 [download]:

  • Camera Models
  • Orthographic Projection
  • Interpretation of Projective and Affine Projections


Homework 1 DUE at 5:00 pm
24 Sep 2004

Lecture 9 [download]

  • Camera Calibration
  • Stereo (introduction)



27 Sep 2004

Lecture 10 [download]

  • Stereo
    Concept of Disparity
    Epipolar Constraint
    Basic Stereo Derivations
  • Binary Image Processing
  • Applying a mask on an image
  • Average Filter
  • Edge Detection



29 Sep 2004

Lecture 11 [download]

  • Filtering
    Average Filter
    Gaussian Filter
    Removing Noise
  • Differentiation
    Discrete approximation
    Gradient Vector
  • Comparison of filtering and differentiation masks
  • Sobel, Prewitt, Robert's operators
  • Detection of Edges
  • Gradient Magnitude and Direction

Homework 2 : Problems, Module 1 [handout]
Due: Wed Oct 6, 2004 at 5:00 pm

Important Annoucement: Midterm on Sat Oct 9 (out of class). Please mark your calendars.

1 Oct 2004

Lecture 12 [download]

  • Properties of Ideal Edge Detector
  • Canny's Edge Detector



4 Oct 2004

Lecture 13 [download]

  • Marr-Hildreth edge detector (Laplacian of Gaussian)
  • Finding lines in binary images
    Least-Squared Error solution and its problems
  • Hough Transform for finding lines
    Concept of parameter space (dual)
    Algorithm using (m,c) parametrization
    Algorithm using (p, theta) parametrization
6 Oct 2004

Lecture 14 [download]

  • Hough transform for finding lines
    (p, theta) parametrization
  • Hough transform for detecting circles, and other parametric shapes
  • Centroid and Area
  • Generalized Hough Transform
    Constructing the R-Table
    Detecting shapes based on R-Table
Homework 2 DUE at 5:00 pm
8 Oct 2004

Lecture 15

  • Discussion of homework solution

Quiz 2 [download]

Midterm Exam tomorrow (9th Oct)
8:45-10:00 am, in A-11
Closed book / closed notes / calculator allowed


9 Oct 2004
Midterm Exam
11 Oct 2004

Lecture 16 [download]

  • Rotation and scaling invariance for GHT
  • Binary Morphology
    Logical Operations: AND, OR, Subtraction
  • Example application using morphology
  • Connected Component Labeling
    Recursive code
    Iterative code
  • Region Properties
    Length of Perimeter

Homework 3: Canny Edge Detector [handout]
Due: Fri Oct 22, 2004 at 5:00 pm

[Shapiro] has a good description of binary operations in Ch 3. The 'gears' example is also taken from [Shapiro]. Region properties and connected component algorithms are also discussed in Ch 3 of [Shah].

13 Oct 2004

Lecture 17 [download]

  • Region Properties
    2nd Moments
  • Motion
    Brightness Constancy Assumption
    Brightness Constancy Equation
    Interpretations of BCE
    Aperture Problem
  • Optical Flow
  • Lucas-Kanade Method for computing optical flow


Reading: Motion Handout

15 Oct 2004

Lecture 18 [download]

  • Limitations of BCE
  • Pyramids
    Reduce Operation
    Expand Operation
  • Lucas-Kanade with Pyramids

Reading: Motion Handout


18 Oct 2004

Lecture 19 [download]

  • Global Flow
  • Affine Global Flow (Bergen/Anandan/Hanna/Hingorani's Method)
    Iterative Refinement
  • Application
    Video Mosaics
    Hierarchical Dominant Motion Estimation

Reading: Motion Handout

20 Oct 2004

Lecture 20 [download]

  • Recognizing Facial Expressions (Black and Yacoob 1997)
  • Projective Global Flow (Szeleski's Method)

Reference Readings: (you may go through these if interested)
Black and Yacoob's paper [web][local]
Szeleski's paper [web][local]

22 Oct 2004

Lecture 21 [download]

  • Discussion of Midterm
  • Mann-Picard method for Projective Global Flow
Mann/Picard paper (if interested) [web][local]
29 Oct 2004

Lecture 22 [download]

  • Pattern Classification Examples
  • Pattern matching using correlation
  • The need for normalization term



1 Nov 2004

Lecture 23 [download]

  • Correlation in Frequency Domain
  • Various Correlation Methods
  • Distance Transform
  • Medial Axis Transform
  • Distance Measures
    • Euclidean
    • City Block
    • Chess Board
  • Properties of a Distance Metric
  • Hausdorff Distance
  • Introduction to Bayes and Nearest Neighbor Classifiers

Readings: Material on classifiers is included in [Shapiro] Ch 4 and [Snyder] Ch 15. Distance transform and Medial Axis transform are described in [Shah] Ch 4

Homework 4 [download]
Due 10th Nov before class (9:50 am)

Dataset for Problem 6:
yosemite1r.pgm yosemite2r.pgm

Dataset for Problem 7:
LUMS sequence: as frames, as zip file

If using MATLAB for pr6&7, the following functions will be useful for reading images:
readbinpgm.m readbinppm.m

3 Nov 2004

Lecture 24 [download]

  • Bayes Classifiers
    • Example, human trackin
  • Change Detection
    • Differencing consecutive frames
    • Background subtraction using single frame
    • Background subtraction using Gaussian model



5 Nov 2004

Lecture 25 [download]

  • Gaussian Background Subtraction
  • Grimson's Method



6 Nov 2004

Lecture 26 [download]

  • Gaussian Background Subtraction
  • Face Recognition (using PCA)
Grimson's paper, discussed in class [web]
8 Nov 2004

Lecture 27 [download]

  • Face Recognition


10 Nov 2004

Lecture 28 [download]

  • Clustering
  • KMeans
  • Agglomerative
  • Divisive
  • Choosing K
  • Segmentation based on color
  • Segmentation based on motion

Homework 4 due