Basic Image Processing for Moving Object Tracking

Download the tutorial files: moving_object_tracking_tutorial.7z (Note: Among other things you will need to have the Computer Vision System Toolbox to run these demos)

This tutorial aims at demonstrating how to use image processing to track a moving object.

We make these tutorials for use to test the up coming camera and image processing utility blockset for Waijung 13.11a, to be release in Nov 2013. So stay tuned…

This tutorial follows the Student Dave’s Tutorials! Basic Image Processing with Matlab, but in Simulink instead of Matlab m-file implementation.

We were able to watch just the 2 video tutorials by Student Dave’s (items 2 and 3 below) and implement this in Simulink in just 1 day without any prior image processing knowledge.

So the explanation is extremely comprehensive, easy-to-understand and, hence, highly recommended.

The Student Dave’s Tutorials! site also contains other simple-to-understand tutorials on such topics as Kalman filtering, Extended Kalman filtering, and Particle filtering.

If you have time, visit the Student Dave’s Tutorials! site and help make some donations to fuel these great tutorials with coffee and Ramen. :)

The followings summarize resources related only to this basic image processing tutorial.

  1. The main basic image processing tutorial site
  2. Excellent short Youtube video part 1 of 2 on the same topic:
  3. Excellent short Youtube video part 2 of 2 on the same topic:
  4. Image source files:
  5. Matlab source files:

The followings summarize steps for moving object tracking:

  1. Subtract still background image from current image to keep only the moving (alien) object.
  2. Apply Guassian filter to smooth the image of the object.
  3. Apply Histrogram Thresholding to identify moving object more precisely.
  4. Compute object position in pixel XY co-ordinate.

Note: we used MakeAVI ( to convert the original video file to individual images.

The followings display different Simulink model files for studying the algorithm progressively.

1) ex01_object_tracking_static_demo.mdl

Test moving object detection algorithm using static picture.

Tracking result

2) ex02_object_tracking_dynamic_demo.mdl

Track moving object from video.

Simulation results

3) ex03_object_tracking_offline_demo.mdl

The same as ex02_object_tracking_dynamic_demo above except that the background image is computed by averaging images from the first few seconds.

See this article for a real-time system implementation.