After OpenCV 3.0, CvMat cannot be directly converted to cv::Mat, we need to use function cvarrToMat() to do it. Please see the code below:
CvMat *cm; cv::Mat m; // Before OpenCV 3.0 m = cm; m = cv::Mat(cm); // After OpenCV 3.0 m = cv::cvarrToMat(cm);