CMSC 426
Image Processing (Computer Vision)
David Jacobs
Fall 2005




There will be a review session for the final exam on Wednesday, Dec. 14 at 1pm in AV Williams 4424.


Office hours on Tuesday, Dec. 13 will be 1-2.


Please do on-line class evaluation.


The penalty for late problem sets will be suspended over the Thanksgiving holiday.  So there will be a 10% penalty if the problem set is handed in by Wed., Nov 23 at 11, a 20% penalty if it is handed in by Monday, Nov 28 at 11, and a 30% penalty if it is handed in by Tuesday, Nov 29 at 11.  No problem sets will be accepted after start of class on Tuesday the 29th. 


Sun Nov 13, 12:16 pm:  Message from Nelson Padua-Perez: As part of the Department of Computer Science's recruiting effort, I will be visiting high schools in MD/VA/DC to encourage students to pursue undergraduate education in computer science and to inform them about the high school program we have (  If you still keep in touch with some of your high school teachers tell them that I will be glad to visit their schools.  They can contact me directly (e-mail: to coordinate the visit.  Thanks.  Nelson


Office hours will in general be Monday, 1-2, Tuesday, 2-3.


Office hours for the week of October 10:  Monday 1-2, Thursday, 2-3.


Note that the foreground image was updated to be a .bmp image.  The jpg image was the wrong size.


Here are some examples of texture synthesis on my_checkerboard output:



I = GrowImage(my_checkerboard(3,3), 5, 10,10)

I = 0 0 0 1 1 0 0 1 1 0

     0 0 0 1 1 0 0 1 1 0

     1 0 0 0 0 1 1 0 0 1

     1 0 0 0 0 1 1 0 0 1

     0 1 1 1 1 0 0 1 1 0

     0 1 1 1 1 0 0 1 1 0

     0 1 1 1 1 0 0 1 1 0

     0 1 1 1 1 0 0 1 1 0

     0 1 1 1 1 0 0 1 1 0

     1 0 0 0 0 1 1 0 0 1


I = GrowImage(my_checkerboard(3,3), 7, 10,10) 


 I = 1 1 1 0 0 0 1 1 1 0

       0 0 0 1 1 1 0 0 0 1

       0 0 0 1 1 1 0 0 0 1

       0 0 0 1 1 1 0 0 0 1

       1 1 1 0 0 0 1 1 1 0

       1 1 1 0 0 0 1 1 1 0

       1 1 1 0 0 0 1 1 1 0

       0 0 0 1 1 1 0 0 0 1 

       0 0 0 1 1 1 0 0 0 1 

       0 0 0 1 1 1 0 0 0 1


My apologies, I made an error on part one of the programming part of problem set 2. The problem set says:

"You should be sure that the width of your filter is at least four sigma, to fully capture the Gaussian."

But in fact, in my implementation I use a filter whose width is at least 8 sigma. The results with a filter of width 8 sigma are noticeably different from one of width 4 sigma which indicates that it is probably better to use 8 sigma; you want to stop when using a bigger filter doesn't cause any difference. It will be perfectly acceptable to use either 4 or 8 in your implementation, but if you use 4 the results you get may be slightly different from those shown in the problem set.


Office hours will be adjusted next week to fit the problem set schedule.  There will be office hours on Monday, 9/26 at 1:00-2:00.  There will not be office hours on Wednesday, 9/28.


Problem Set 2 was initially posted on Tuesday, 9/13.  It was updated on 9/15, because of a bug in my implementation of the edge detector.  The images for problems 4 and 5 were changed, and the suggested parameters needed to get these images were also changed.  The following hint was added, to help you avoid this bug:


Hint: It will be a good idea to turn your image into a matrix of floating point numbers using the double function. If not, you will get into trouble, because images are constrained to be non-negative integers below 255. If, for example, the gradient is sometimes negative, it cannot be stored in an image.


For this week, I would like to reschedule office hours to be on Thursday, Sept 8 1-2 and Monday, Sept. 12, 11-12.


Message from Nelson Padua-Perez  Dear students: I would really appreciate it if you can spread the word about a high school program we have in the Dept of Computer Science for students interested in computer science/computer programming.   Currently, we are accepting applications for this Fall (the program starts on Oct 1).  The program's web site is:  In addition, I would like to inform you that we have set a mailing list to provide general information (e.g., classes, seminars, competitions, etc.) to high school students and high school administrators interested in computer science/computer programming.  Information about the mailing list is available at:


General Information




Class Time 

Tue, Thu 11:00-12:15


CSI 2120

Course Info



There is no assigned text, but you will receive course notes, and may want to consult two optional books:

  • Introductory Techniques for 3-D Computer Vision by Trucco and Verri
  • Computer Vision: A Modern Approach by Forsyth and Ponce

                                 Graduate students taking this course may, in particular, want to purchase Forsyth and Ponce.

These books are on reserve in the CS library on the 3rd floor of AV Williams





Teaching Assistant


David Jacobs

Ryan Farrell


farrell (at)


AVW 4421


Office hours

Tue 2:00-3:00, Mon 1:00-2:00 


If you cannot make these office hours, please send email to arrange another time. 

Below is a tentative schedule for problem sets and lectures.










  Problem Set

    Problem Set 1 : Matlab intro (Correlation) and review of some math (extrema, harmonic functions, integrals, inner products) Problem Set

Sept 6

Sept 13

Problem Set 2: Edge Detection (Implement 2D edge detection), paper and pencil problems about gradients.  Problem Set  You will also use the following Matlab files: test_smooth_image.m, test_image_gradient.m, test_gradient_magnitude_direction.m, interpolate_gradients.m, and the images: swanbw.jpg, swanedges.jpg, swanedges_h.jpg

Sept 13

Sept 27


Problem Set 3: Texture synthesis and background subtraction.  Here is the Problem Set.  You will need the following files:, foreground_image.bmp, BackgroundSubtractionResults.jpg, GrowImageShell.m.  Here is a texture image you can try things out on: brickbw.jpg, and code for generating simple checkerboards.  Using a value of n=5, we generated this brick textureHere is a version that is the exact size and value of the brick texture. 

Sept 27

Oct 11


Practice Midterm (not to be turned in).  Practice Midterm

Oct 11

Oct 13


    Problem Set 4: K-Means  Problem Set  swanbw.jpg  swanbw_KMeans_90_150_230.jpg 

Solution: KMeansBW.m

 Oct 25

Nov 1


    Problem Set 5: Geometry and projection (paper and pencil) Problem Set

 Nov 1

Nov 8


    Problem Set 6: Stereo (shortest path, reconstruction)  Problem Set.  You may want to use my shortest path code, shortest_path.m.  For part 1d you will need the left and right random dot stereogram images.  For part 1d and the challenge problem you will also need to use the left and right images from Tsukuba.  Here is a picture of  the results that I get on the indicated subimages of the Tsukuba images.  Here is an image containing the actual disparity values plus 1.  I added one to each value so that 0 indicates occlusion, 1 indicates disparity of 0, ... so that I could store these in a jpeg, which doesn't like negative intensities. 

 Nov 8

Nov 22


    Problem Set 7: Matrix representations of motion (paper and pencil), Corner detection and affine structure from motion.  Problem Set.  You can use the routine display_best_corners.m.  The results I get on the image swanbw.jpg are shown in the image swancorners.jpg

 Nov 22

Dec 8


  Review for Final: Review with practice problems



A hardcopy of all solutions and code should be turned in by end of class on the assigned date.  If the assignment involves writing Matlab code, all code should be emailed to the TA also, so that it can be run, if needed.  Please tar all matlab files into one file named student_name_psX and email it to Ryan Farrell (farrell (at) 

Problems not completed on time can be turned in late.  You will lose 10% credit for each day you are late.  However, problems due Tuesday must be turned in by Thursday.  Problems due Thursday must be turned in by the following Tuesday.  This will allow me to discuss solutions in the next class, or post solutions. 

Class slides will typically be posted here, usually minutes before class begins.  In most cases, you can find a good approximation to these slides from 2004's class, accessible from my home page.





  Class Slides

   Class  1 :      Introduction (Sept 1): Powerpoint  Web page




   Class  2 :      Introduction to Matlab, Linear Algebra Review (vectors, matrix multiplication), Begin Filtering (Sept 6):  Powerpoint Web page matlab examples

Correlation and Convolution Notes


Tutorial from Sussex on Convolution



   Class  3 :      Filtering (cont'd); Fourier Transforms, Sampling  (Sept 8) Powerpoint Web page matlab examples




   Class  4:       Edge Detection - 1D (Sept 13)  Powerpoint  Web page  matlab examples

Tutorial from Sussex on Gaussian filtering and edge detection



   Class  5:       Gradients, Edge Detection -2D (Sept 15)

Gradient Notes


Canny Edge Detector, from CVonline



   Class  6 :       Probability and Statistics for Appearance Modeling (Indepedence, Markov models, Gaussian distributions) (Sept 20) Powerpoint  Web page




   Class  7 :      Background Subtraction  (Sept 22) (see previous class notes)

Statistics Notes



   Class  8:       Texture using Markov models  (Sept 27) PDF of slides Matlab

Chapter 9, Forsyth and Ponce

Efros and Leung web page



   Class  9:      Fourier Transforms:   (Sept 29)  PDF of slides


Human perceptual grouping

Reading "Laws of organization in perceptual forms" at




   Class 10:      SNAKEs (finding boundaries) (Oct 6)  PDF of slides




   Class 11:    Grouping: clustering, K-means, RANSAC (Oct 6)  PDF of slides




Class 12: C atch-up (or EM, if we're caught up) (Oct 11)




   Class 13:     Review for Midterm (Oct 13)




   Midterm (Oct 18) 




Class 14: Go over midterm.  (Oct 20)




   Class 15:     K-Means (Oct 25) See slides from October 6 class

Yair Weiss' EM Tutorial



   Class 16:     Lines, Planes, Geometry of Image Formation, Stereo (1) (Oct 27).

Geometry Notes



   Class 17:     Stereo (2), Matrices  (Nov 8)  PDF of slides




   Class 18:     Matrices (rank and svd ), Corner Detection  (Nov 10) ppt web page  pdf

Note: Dave Mount's lecture notes from Computer Graphics (see right) cover much of this material very well.  His presentation is a bit different (and probably better) than mine.

Dave Mount's Lecture Notes for Computer Graphics, Chapters 7 and 8.



  We're a bit behind so the schedule isn't exactly aligned with the classes.








   Class 21:     Affine Structure from Motion (1 ) -  (Nov 15)   PDF of Slides

See also Forsyth and Ponce Section 12.2



   Class 22:     Affine Structure from Motion (2) -  (Nov 17) 




   Class 23:     Corners - (Nov 22) PDF of Slides

Trucco and Verri, 82-85.



   Class 24:     Matching and Optical Flow I   (Nov 29)  PDF of Slides




   Class 25:     




   Class 26:     Recognition I  (Dec 6)   PDF of Slides




   Class 27:     Recognition II  (Dec 8)





   Class 28:      Summary  (Dec 13)  PDF of Slides





   Review for Final (Dec. 14)  Review will be at 1pm in AV Williams 4424.





   FINAL   Thursday, Dec 15, 8am in the classroom. 





Useful Links

 Image Processing Learning resources:

 MATLAB resources:

  Introductory Tutorials

MATLAB tutorial from University of Utah

MATLAB tutorial from Carnegie Mellon University

MATLAB tutorial from Indiana University

  Slightly more advanced Tutorials

  More complete references/tutorials/FAQs

 Computer Vision related sites:

Lightness Perception and Lightness Illusions

MIT computer vision class

Penn State computer vision class

Grad course at Maryland

An extensive computer vision bibliography at USC

Pointers to many vision classes

A tutorial on drawing with perspective

Some computer vision tutorials from Sussex

Some visual illusions

Computer Vision on-line demos

CVonline  This site contains a wealth of material describing much of what we'll discuss in class.