opencv矩阵的格式输出

Mat E = Mat::eye(2,2,CV_16F);
cout<<"默认风格:
"<<E<<endl;
cout<<"默认风格:
"<<format(E,Formatter::FMT_DEFAULT)<<endl;
cout<<"Python风格:
"<<format(E,Formatter::FMT_PYTHON)<<endl;
cout<<"C风格:
"<<format(E,Formatter::FMT_C)<<endl;
cout<<"CSV风格:
"<<format(E,Formatter::FMT_CSV)<<endl;
cout<<"Matlab风格:
"<<format(E,Formatter::FMT_MATLAB)<<endl;
cout<<"Numpy风格:
"<<format(E,Formatter::FMT_NUMPY)<<endl;

  

默认风格:
[1, 0;
 0, 1]
默认风格:
[1, 0;
 0, 1]
Python风格:
[[1, 0],
 [0, 1]]
C风格:
{1, 0,
 0, 1}
CSV风格:
1, 0
0, 1

Matlab风格:
(:, :, 1) = 
1, 0;
0, 1
Numpy风格:
array([[1, 0],
       [0, 1]], dtype='float16')

  

原文地址:https://www.cnblogs.com/navysummer/p/12345888.html