mysql opencv mat_OpenCV的5种格式化输出方法Mat类型数据

#include

#include

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;

aa5e6bfd36605cf7a0fae29c04ba18ad.png

2、

cout << "r(Python风格_openCV2) = " << format(r, "python") << ";" << endl << endl;

cout << "r(Python风格_openCV3) = " << format(r, Formatter::FMT_PYTHON) << ";" << endl << endl;

c4166627345f9bcac1a9a2e8430168bf.png

3、

cout << "r(,分隔风格_openCV2) = " << format(r, "csv") << ";" << endl << endl;

cout << "r(,分隔风格_openCV3) = " << format(r, Formatter::FMT_CSV) << ";" << endl << endl;

44b8c942d8f693a1109c1d17c47bd417.png

4、

cout << "r(numpy风格_openCV2) = " << format(r, "numpy") << ";" << endl << endl;

cout << "r(numpy风格_openCV3) = " << format(r, Formatter::FMT_NUMPY) << ";" << endl << endl;

611d89ff86e41fa901c0a074444ae684.png

5、

// cout << "r(C语言风格_openCV2) = " << format(r, "c") << ";" << endl << endl;

cout << "r(C语言风格_openCV3) = " << format(r, Formatter::FMT_C) << ";" << endl << endl;

b5ba6ad637a0169064937dcb0242a5d8.png

-----

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值