#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
system("chcp 65001"); //控制台中文支持
Mat r = Mat(10, 3, CV_8UC3);
randu(r, Scalar::all(0), Scalar::all(255)); //randu随机矩阵[0, 255]之间
cout << "r(opencv默认风格) = " << r << ";" << endl << endl;
// cout << "r(Python风格_openCV2) = " << format(r, "python") << ";" << endl << endl;
cout << "r(Python风格_openCV3) = " << format(r, Formatter::FMT_PYTHON) << ";" << endl << endl;
//cout << "r(,分隔风格_openCV2) = " << format(r, "csv") << ";" << endl << endl;
cout << "r(,分隔风格_openCV3) = " << format(r, Formatter::FMT_CSV) << ";" << endl << endl;
//cout << "r(numpy风格_openCV2) = " << format(r, "numpy") << ";" << endl << endl;
cout << "r(numpy风格_openCV3) = " << format(r, Formatter::FMT_NUMPY) << ";" << endl << endl;
// cout << "r(C语言风格_openCV2) = " << format(r, "c") << ";" << endl << endl;
cout << "r(C语言风格_openCV3) = " << format(r, Formatter::FMT_C) << ";" << endl << endl;
return 0;
}
0、准备
system("chcp 65001"); //控制台中文支持
Mat r = Mat(10, 3, CV_8UC3);
randu(r, Scalar::all(0), Scalar::all(255)); //randu随机矩阵[0, 255]之间
1、默认风格
cout << "r(opencv默认风格) = " << r << ";" << endl << endl;
2、
cout << "r(Python风格_openCV2) = " << format(r, "python") << ";" << endl << endl;
cout << "r(Python风格_openCV3) = " << format(r, Formatter::FMT_PYTHON) << ";" << endl << endl;
3、
cout << "r(,分隔风格_openCV2) = " << format(r, "csv") << ";" << endl << endl;
cout << "r(,分隔风格_openCV3) = " << format(r, Formatter::FMT_CSV) << ";" << endl << endl;
4、
cout << "r(numpy风格_openCV2) = " << format(r, "numpy") << ";" << endl << endl;
cout << "r(numpy风格_openCV3) = " << format(r, Formatter::FMT_NUMPY) << ";" << endl << endl;
5、
// cout << "r(C语言风格_openCV2) = " << format(r, "c") << ";" << endl << endl;
cout << "r(C语言风格_openCV3) = " << format(r, Formatter::FMT_C) << ";" << endl << endl;
-----