Change code to work with latest OpenCV 2.*