Fixed compilation erros in a few files

I was using this code to get up to speed with opencv 3.0 but ended up getting compilation errors. I've spent a few hours fixing these errors so the code compiles (and works) with the current version of opencv 3.0.