Some modifications for compatibility with OpenCV 3.0 beta