Computer Vision (Como) and Image Analysis and Synthesis (Milano), Prof. Caglioti, AA 2009/2010

Here are the transcripts of the matlab sessions (in order of presentation).

  • Use of homogeneous corrdinates for drawing a cube from six points, in perspective projection.  Covers points, lines, join of points, intersections of lines, vanishing points, simple drawing commands, image reading, clicking of points to get coordinates. [link]
  • use of homogeneous corrdinates for drawing a cube from four points, under parallel projection.  Additionally covers parallelism, incidence relations. [link]
  • Understanding conics under homogeneous coordinates. Covers conics, images and their range, incidence relation for conics, some pole-polar relations and simple linear transformations. [link]
  • Conic passing through 5 points.  Also covers the dual conic. [link]
  • Projection of points using the camera matrix.  Also covers crossratio invariance [link]. Extension to drawing a checkerboard [link]. Utility matlab functions for projecting points properly (checking that they are in front of the camera), and for generating a camera matrix given few key vectors frequently used in computer graphics.
  • Stitching of two images of the same scene taken with different camera rotation, but still without moving the camera center.  Then you have an homography which relates the two images. [link]
  • The solved exercise about two vertical sticks and their shadows is at page 3 of this PDF.
  • Find the images of the eiffel tower and the construction to find the height here.
  • Dec 17 2009: several students which could not follow the short presentation about video processing asked for some cues for solving the homework. None of the things which were presented was fundamental: most were just implementation tricks for writing better code.  Here are the most important.

    • Read frames using imread inside a cycle. Generate the filename using sprintf.

    • It may be helpful to place all images in the same matrix (careful: this does not scale to longer videos!).  With color data, that will be a 4 dimensional matrix (rows, columns, rgb channels (3), frames).  An advantage of this is that you can then use the usual functions like sum, mean, median.  Look in the help for the possible syntaxes of these functions: you can specify which dimension they operate on!

    • If you see unexpected results, most probably is due tu unexpected datatypes: for example, the mean funciton returns double even if fed with uint8 (and that's a reasonable behavior, BTW).  Related: do not subtract uint8 matrices, as you can't get negative values this way. One option is to use the double datatype from the beginning to the end and just forget about integers; this will save a bit of trouble but increases memory consumption a lot.

  • Jan 4, 2010.  Answers to frequently asked questions.
    • The "background" in part 2 step 5, is the image of the scene without the moving object.  You can obviously re-use the result in the previous step, if you explain why this is meaningful.
    • Jan 7 2010: Consider the result of background subtraction:
      • Where the result of the subtraction is 0 or near to 0, the image and background were similar, thus we have a pixel which is likely to be background.
      • Where the result of the subtraction is far from 0, the image and background were significantly different, thus we have a pixel which is likely to be foregound ("object").
      • This should suggest that you need to use an absolute value somewhere. Do you really care whether the result of the subtraction is -20 or +20?
    • When you use regionprops after background subtraction and binarization, for detecting the ball centroid in the video frames, you may get many regions for each frame.  This is due to problems in the binarization.  You can ask regionprops to also compute the area of each region, and consider the largest region for each frame as the region you are interested in.  Or, you may apply morphological processing like binary opening or closure before applying regionprops.
    • For drawing a 3D object on the sheets of paper, you need to find the vertical vanishing point.  You can do this if you know the horizon line and the camera intrinsic parameters.
    • Even if you can not solve few points, you should still submit the homework and try to complete it as much as possible!

If you have any question or spot any error, please contact me.

You can find the materials by Giacomo Boracchi on image processing here.

Dec 11 2009: Homework available here.  Includes document (with requirements and rules) and data.

NEW Feb 5 2010: a couple of well-done homeworks as a solution example.

  • By Fabio Beltramini (in italian).
    Note that in Part 3, point 2 there is an imprecision as the following sentence is false: "le rette sarebbero state parallele e si sarebbero intersecate in un solo punto solo se l’immagine della traiettoria fosse stata una parabola e non una generica conica".
  • By Giovanni Condello (in english).
    Note that the first section in Part 1, point 6 is wrong, as the world -> image transform is more general than an affine transform.