Fixed code to work with OpenCV 3.0 (git)