CIS 601 Spring 2007

Homework 3: Detecting Moving Objects


This time you'll build the basis of a surveillance system. Given a series of grayvalue pictures, you have to segment the moving object in the scene. This very basic version of a surveillance system will just detect pixels that changed their gray value, using background subtraction. I do not ask for real object following or even object recognition (that will come later!).

The MATLAB WORKSPACE contains a variable 'ag'. 'ag' is a 240x320x56 matrix containing 56 grayvalue images taken from a movie (starring a famous professor). The movie shows a static indoor scene with a single moving object, the following images show 3 frames out of the 56.



You can show the images as a movie using the following code:
for i=1:size(ag,3)
imshow(ag(:,:,i));
pause(0.03);
end

Your task:

So far it's 7 points. Additional 3 points:
You might wonder if the system could be improved, if the background image is not just built averaging all images. Since averaging all images also learns foreground pixels as background, the idea is to filter frames where there's surely a huge amount of foreground and not to use these frames in the background building process. How to in its simplest form:


All this sounds like a lot, but the whole program is less than 20 lines of code. Think how to use MATLAB wisely!

Good luck and enjoy!