CS 332

Assignment 3

Due: Friday, October 7

This assignment contains one extended problem in which you will implement a stategy to track the moving cars in a video of an aerial view of a traffic scene, and visualize the results. You are encouraged to work with a partner on this problem!

Problem: Tracking Moving Objects

The /home/cs332/download/tracking folder contains a video file named sequence.mpg that was obtained from a static camera mounted on a building high above an intersection. The first image frame of the video is shown below:

The code file named getVideoImages.m contains a script that reads the video file into MATLAB, shows the movie in a figure window, extracts three images from the file (frames 1, 5, and 9 of the video), displays the first image using imtool, and shows a simple movie of the three extracted images, cycling back and forth five times through the images. We will go over the getVideoImages.m code file in class, which uses the concept of a structure in MATLAB, and the built-in functions VideoReader, struct, read, and movie.

Most of the visual scene is stationary, but there are a few moving cars and pedestrians, and a changing clock in the bottom right corner. Your task is to detect the moving cars and determine their movement over the three image frames stored in the variables im1, im2, and im3. (Note that the clock has been removed from these three images.) To solve this problem, you will use a strategy that takes advantage of the fact that most of the scene is stationary, so changes in the images over time occur mainly in the vicinity of moving objects. The image regions that are likely to contain the moving cars are fairly large regions that are changing over time.

Create a new script named trackCars.m in the tracking folder, to place your code to analyze and display the movement of the cars across the three images provided. (You are welcome to define separate functions for subtasks, but this is not necessary.) Implement a solution strategy that incorporates the following steps:

Hints: The file codeTips.m in the tracking folder provides simple examples of some helpful coding strategies, including examples that use the built-in bwlabel and regionprops functions, access information stored in a vector of structures, and superimpose graphics (using the built-in plot and scatter functions), on an image that is displayed in a figure window.

Be sure to comment your code so that your solution strategy is clear!

Submission details: Hand in a hardcopy of any code files that you wrote or modified. Drop off an electronic copy of your code files by logging into the CS file server, connecting to your tracking folder, and executing the following command:

submit cs332 tracking *.*