#include <iostream>
static void help(char** argv)
{
cout
<< "\n------------------------------------------------------------------\n"
<< " 该程序展示了 cv::Mat 的串行输出功能\n"
<< "也就是,cv::Mat M(...); cout << M; 现在可以工作了。\n"
<< "输出可以格式化为 OpenCV,matlab,python,numpy,csv 和 \n"
<< "C 风格的使用方式:\n"
<< argv[0]
<< "\n------------------------------------------------------------------\n\n"
<< endl;
}
int main(
int argc,
char** argv)
{
if (parser.has("help"))
{
help(argv);
return 0;
}
cout << "I = \n" << I << ";" << endl << endl;
randu(r, Scalar::all(0), Scalar::all(255));
cout << "r (默认) = \n" << r << ";" << endl << endl;
cout <<
"r (matlab) = \n" <<
format(r, Formatter::FMT_MATLAB) <<
";" << endl << endl;
cout <<
"r (python) = \n" <<
format(r, Formatter::FMT_PYTHON) <<
";" << endl << endl;
cout <<
"r (numpy) = \n" <<
format(r, Formatter::FMT_NUMPY) <<
";" << endl << endl;
cout <<
"r (csv) = \n" <<
format(r, Formatter::FMT_CSV) <<
";" << endl << endl;
cout <<
"r (c) = \n" <<
format(r, Formatter::FMT_C) <<
";" << endl << endl;
cout << "p = " << p << ";" << endl;
cout << "p3f = " << p3f << ";" << endl;
vector<float> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cout <<
"shortvec = " <<
Mat(v) << endl;
vector<Point2f> points(20);
for (size_t i = 0; i < points.size(); ++i)
points[i] =
Point2f((
float)(i * 5), (
float)(i % 7));
cout << "points = " << points << ";" << endl;
return 0;
}
用于命令行解析。
定义 utility.hpp:820
_Tp & at(int i0=0)
返回指定数组元素的引用。
3D 点的模板类,由其坐标 x,y 和 z 指定。
定义 types.hpp:255
void randu(InputOutputArray dst, InputArray low, InputArray high)
生成单个均匀分布的随机数或随机数数组。
#define CV_64F
定义 interface.h:79
#define CV_8UC3
定义 interface.h:90
String format(const char *fmt,...)
返回使用 printf 风格表达式格式化的文本字符串。
#define CV_PI
定义 cvdef.h:380
int main(int argc, char *argv[])
定义 highgui_qt.cpp:3
与磁盘上文件关联的文件存储的“黑盒”表示。
定义 core.hpp:102