I did this as a project for my computer vision class. You can download:
Once you run the program hit h to view on screen help for the controls.