fix build with OpenCV 2.3
fix opencv exception with 2-channels matrix