Opencv的格式化输出风格

来源:互联网 发布:淘宝卖家订单险多少钱 编辑:程序博客网 时间:2024/06/01 09:41
  • 默认风格 C++
cout << r << endl;
[1,2,3,.....]

  • python 风格 列表形式,一组通道,一个列表
cout << format(r,"pyhon")<< endl;
[[1,2,3],[1,2,3], ..                  ]

  • 逗号分隔 comma separated values  csv
cout << format(r,"csv") << endl;
1,2,3,4,5,6 ...

  • Numpy风格
cout << format(r,"Numpy") << endl;
  • c 风格
cout << format(r,"C") << endl;
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  • 二维点的额输出
Point2f  p(6,2);
cout << p << endl;
 [6,2];
  • 三维点的输出
Point3f  p(6,2,1);
cout << p << endl;
[6,2,1]
  • 输出Mat类的std::vector    列向量
vector<int> v;
v.push_back(3);
v.push_back(5);
cout << Mat(v )<< endl;
[3;
5]

vector 要用cout 输出 ,只能for 遍历?
  • 输出2维 vector
vector<Point2f> v(20);
for(int i = 0 ;i < v.size();++i)
{
v[i] = Point2f(i,i);
cout << v[i] << endl;

}
原创粉丝点击