cv::Scalar scalar1(v); cv::Mat mat3(size,CV_8UC1,scalar1); std::cout<<mat3<<std::endl; std::cout<<std::endl; int a[2][3][3]={ {{0,0,0},{0,0,0},{0,0,0}}, {{0,0,0},{0,0,0},{0,0,0}} }; cv::Mat mat4(2,a[0][0],CV_8UC1); std::cout<<mat4<<std::endl; std::cout<<std::endl; std::vector<std::vector<int>> arr2(2,std::vector<int>(3,20)); // 创建二维数组 //std::vector<int>arr2(2); cv::Mat mat5(arr2,CV_8UC1); std::cout<<mat5<<std::endl; std::cout<<std::endl; cv::Mat mat6=(cv::Mat_<double>(2,3)<<1.2,1.3,0.1,0.5,9.3,8.6); std::cout<<mat6<<std::endl; std::cout<<std::endl; return 0; }