cv:Mat mat; int rows = mat.rows; int cols = mat.cols; cv::Size s = mat.size(); rows = s.height; cols = s.width;