Just I was wondering if this code could work for a grays-cale images, or there is another version of the code. what I am doing now is to convert the gray images to rgb and then estimate motion. I want to save more time by doing it directly on the gray images if possible, thanks for the help.
Tim: I had the same ghost image problem; I fixed it by adding 'set(gcf, 'Renderer', 'zbuffer') around line 18 (after 'set(gca, 'nextplot' ...). I also changed the background color to white because the default was grey by using 'set(gcf, 'Color', [1 1 1])'. Hope that helps.