Make the code compileable on OpenCV 2.4.10

Currently using OpenCV 2.4.10 on Mac OS X 10.10 Yosemite. Did not update the code of Windows.